\App\ApiModule\Version0\MiddlewaresAuthenticationMiddleware

Authentication middleware

Summary

Methods
Properties
Constants
__construct()
__invoke()
No public properties found
WHITELISTED_PATHS
isWhitelisted()
No protected properties found
N/A
createUnauthorizedResponse()
$authenticator
N/A

Constants

WHITELISTED_PATHS

WHITELISTED_PATHS = ['/api/v0/openapi', '/api/v0/user/signIn'] : 

Whitelisted paths

Properties

$authenticator

$authenticator : \Contributte\Middlewares\Security\IAuthenticator

Type

\Contributte\Middlewares\Security\IAuthenticator — Authenticator

Methods

__construct()

__construct(\Contributte\Middlewares\Security\IAuthenticator  $authenticator) : mixed

Constructor

Parameters

\Contributte\Middlewares\Security\IAuthenticator $authenticator

Authenticator

Returns

mixed

__invoke()

__invoke(\Psr\Http\Message\ServerRequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response, callable  $next) : \Psr\Http\Message\ResponseInterface

Parameters

\Psr\Http\Message\ServerRequestInterface $request
\Psr\Http\Message\ResponseInterface $response
callable $next

Returns

\Psr\Http\Message\ResponseInterface

isWhitelisted()

isWhitelisted(\Psr\Http\Message\ServerRequestInterface  $request) : bool

Checks if the path is whitelisted

Parameters

\Psr\Http\Message\ServerRequestInterface $request

API request

Returns

bool —

Is the path whitelisted?

createUnauthorizedResponse()

createUnauthorizedResponse(\Psr\Http\Message\ResponseInterface  $response, string  $message) : \Psr\Http\Message\ResponseInterface

Creates unauthorized response

Parameters

\Psr\Http\Message\ResponseInterface $response

Response to modify

string $message

Message

Returns

\Psr\Http\Message\ResponseInterface —

Response