SessionMiddleware
extends BaseMiddleware
in package
Reads data from token provided from user and passes it as a session to the request context
Table of Contents
- $logger : LoggerInterface
- $request : ServerRequestInterface
- HTTP request
- $tokenFactory : ITokenFactory
- __construct() : mixed
- process() : ResponseInterface
- abstracts away logic needed for all other middlewares
- processRequest() : ResponseInterface
- Process an incoming server request
- getMethod() : string
- gets method of the request
- getPath() : string
- gets path of the request
- getSession() : object
- returns session object with token data
- getToken() : string
- Gets token from authorization header
Properties
$logger
protected
LoggerInterface
$logger
$request
HTTP request
protected
ServerRequestInterface
$request
$tokenFactory
private
ITokenFactory
$tokenFactory
Methods
__construct()
public
__construct(LoggerInterface $logger, ITokenFactory $tokenFactory) : mixed
Parameters
- $logger : LoggerInterface
- $tokenFactory : ITokenFactory
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 —processRequest()
Process an incoming server request
public
processRequest(RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $handler : RequestHandlerInterface
Tags
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 —getToken()
Gets token from authorization header
private
getToken() : string