BaseAuthorizationMiddleware
extends BaseMiddleware
in package
Table of Contents
- $accessRepository : IAccessRepository
- $logger : LoggerInterface
- $request : ServerRequestInterface
- HTTP request
- $subject : string
- $subjectId : int|null
- $userAccess : Access
- __construct() : mixed
- process() : ResponseInterface
- abstracts away logic needed for all other middlewares
- getMethod() : string
- gets method of the request
- getPath() : string
- gets path of the request
- getSession() : object
- returns session object with token data
- processRequest() : ResponseInterface
- Process an incoming server request
- resolveAccess() : bool
- returns false if user doesn't have an access to operation
- setRequestSubject() : void
- gets subject and subject id (if exists) from the request path i.e: /users/1 => subject = 'users'; subjectId = 1
Properties
$accessRepository
protected
IAccessRepository
$accessRepository
$logger
protected
LoggerInterface
$logger
$request
HTTP request
protected
ServerRequestInterface
$request
$subject
protected
string
$subject
$subjectId
protected
int|null
$subjectId
= NULL
$userAccess
protected
Access
$userAccess
Methods
__construct()
public
__construct(IAccessRepository $accessRepository, LoggerInterface $logger) : mixed
Parameters
- $accessRepository : IAccessRepository
- $logger : LoggerInterface
Return values
mixed —process()
abstracts away logic needed for all other middlewares
public
process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $handler : RequestHandlerInterface
Return values
ResponseInterface —getMethod()
gets method of the request
protected
getMethod() : string
Return values
string —getPath()
gets path of the request
protected
getPath() : string
Return values
string —getSession()
returns session object with token data
protected
getSession() : object
Return values
object —processRequest()
Process an incoming server request
protected
processRequest(RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $handler : RequestHandlerInterface
Return values
ResponseInterface —resolveAccess()
returns false if user doesn't have an access to operation
protected
abstract resolveAccess() : bool
Return values
bool —setRequestSubject()
gets subject and subject id (if exists) from the request path i.e: /users/1 => subject = 'users'; subjectId = 1
private
setRequestSubject() : void