ApiKeyAuthenticationMiddleware
class ApiKeyAuthenticationMiddleware (View source)
API Key Authentication Middleware
This middleware checks for API key in request headers and authenticates the user if the key is valid
Methods
Process the request
Get authenticated user ID from API key (stateless)
Get the api_keys row id for the request's key (stateless), for audit logging.
Get the permission scope of the request's API key (stateless)
Handle anonymous request on API routes that require authentication
Details
__construct(PDO $db, ConfigurationManager $config)
Constructor
bool
process(Request $request)
Process the request
int
getAuthenticatedUserId(Request $request)
Get authenticated user ID from API key (stateless)
int|null
getAuthenticatedApiKeyId(Request $request)
Get the api_keys row id for the request's key (stateless), for audit logging.
ApiKeyScope|null
getApiKeyScope(Request $request)
Get the permission scope of the request's API key (stateless)
JsonResponse
handleUnauthenticated()
Handle anonymous request on API routes that require authentication