class AuthMiddleware implements MiddlewareInterface

Middleware base class

Properties

protected array $authProviders Auth provider
protected array $options Options

Methods

__construct(array $authProviders, array $options = [])

Constructor

void
setAuthProviders(array $authProviders)

Set Auth providers

ResponseInterface
process(ServerRequestInterface $request, RequestHandlerInterface $handler)

Process middleware

getAuthProvider($name)

Get auth provider

string
handleError(ServerRequestInterface $request, RequestHandlerInterface $handler)

Show auth error

mixed
getOption(string $key, mixed|null $default = null)

Get option value

Details

at line 48
__construct(array $authProviders, array $options = [])

Constructor

Parameters

array $authProviders
array $options

at line 60
void setAuthProviders(array $authProviders)

Set Auth providers

Parameters

array $authProviders

Return Value

void

at line 72
ResponseInterface process(ServerRequestInterface $request, RequestHandlerInterface $handler)

Process middleware

Parameters

ServerRequestInterface $request
RequestHandlerInterface $handler

Return Value

ResponseInterface

at line 99
AuthProviderInterface|null getAuthProvider($name)

Get auth provider

Parameters

$name

Return Value

AuthProviderInterface|null

at line 112
protected string handleError(ServerRequestInterface $request, RequestHandlerInterface $handler)

Show auth error

Parameters

ServerRequestInterface $request
RequestHandlerInterface $handler

Return Value

string

Exceptions

HttpNotFoundException

at line 140
protected mixed getOption(string $key, mixed|null $default = null)

Get option value

Parameters

string $key
mixed|null $default

Return Value

mixed