AuthMiddleware
extends Middleware
in package
implements
MiddlewareInterface
Auth Middleware base class
Table of Contents
Interfaces
- MiddlewareInterface
- Middleware interface
Properties
- $authProviders : array<string|int, mixed>
- Auth provider
- $container : ContainerInterface|null
- Container
- $options : array<string|int, mixed>
- Middleware options
Methods
- __construct() : mixed
- Constructor
- getAuthProvider() : AuthProviderInterface|null
- Get auth provider
- getOption() : mixed|null
- Get option value
- getOptions() : array<string|int, mixed>
- Return all options
- process() : ResponseInterface
- Process middleware
- setAuthProviders() : void
- Set Auth providers
- setOption() : void
- Set option
- withOption() : Middleware
- Set option
- handleError() : ResponseInterface
- Show auth error
Properties
$authProviders
Auth provider
protected
array<string|int, mixed>
$authProviders
$container
Container
protected
ContainerInterface|null
$container
= null
$options
Middleware options
protected
array<string|int, mixed>
$options
= []
Methods
__construct()
Constructor
public
__construct([mixed $container = null ][, array<string|int, mixed>|null $options = [] ]) : mixed
Parameters
- $container : mixed = null
- $options : array<string|int, mixed>|null = []
getAuthProvider()
Get auth provider
public
getAuthProvider(mixed $name) : AuthProviderInterface|null
Parameters
- $name : mixed
Return values
AuthProviderInterface|nullgetOption()
Get option value
public
getOption(string $name[, mixed $default = null ]) : mixed|null
Parameters
- $name : string
- $default : mixed = null
Return values
mixed|nullgetOptions()
Return all options
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>process()
Process middleware
public
process(ServerRequestInterface $request, ResponseInterface $response) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
Return values
ResponseInterfacesetAuthProviders()
Set Auth providers
public
setAuthProviders(array<string|int, mixed> $authProviders) : void
Parameters
- $authProviders : array<string|int, mixed>
setOption()
Set option
public
setOption(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
withOption()
Set option
public
withOption(string $name, mixed $value) : Middleware
Parameters
- $name : string
- $value : mixed
Return values
MiddlewarehandleError()
Show auth error
protected
handleError(ResponseInterface $response) : ResponseInterface
Parameters
- $response : ResponseInterface