AuthenticationChecker
in package
Helper class to check whether users are allowed to execute the request
Tags
Table of Contents
- AUTHENTICATION_COOKIE_NAME = 'JinyaApiKey'
- checkRequestForUser() : Artist
- This method checks if the requested role is valid for the user currently logged in.
- getApiKeyFromRequest() : ApiKey|null
- Retrieves the api key from the request based on all available authorization methods
Constants
AUTHENTICATION_COOKIE_NAME
public
mixed
AUTHENTICATION_COOKIE_NAME
= 'JinyaApiKey'
Tags
Methods
checkRequestForUser()
This method checks if the requested role is valid for the user currently logged in.
public
static checkRequestForUser(ServerRequestInterface $request, string|null $role) : Artist
If the artist is logged in and has the given role, it is returned otherwise an exception is thrown.
Parameters
- $request : ServerRequestInterface
-
The current request
- $role : string|null
-
The role to check for
Tags
Return values
Artist —The artist containing the given role
getApiKeyFromRequest()
Retrieves the api key from the request based on all available authorization methods
public
static getApiKeyFromRequest(ServerRequestInterface $request) : ApiKey|null
Parameters
- $request : ServerRequestInterface