Authenticator

Authentication plugin for the middleware dispatcher.

class Authenticator implements Plugin
Copyright
2015-2016 Appertly
License
Apache-2.0

Instance Properties

Protected
NameTypeSummary
$authUrlstring
$serviceService

Constructors / Destructors

Public
ReturnsSignature and Description
void
__construct(Service $service, string $authUrl)

Creates a new AuthPlugin.

Instance Methods

Public
ReturnsSignature and Description
ResponseInterface
__invoke(ServerRequestInterface $request, ResponseInterface $response, (function(Request,Response):Response) $next)

Allows a plugin to issue a response before the request is dispatched.

int

Gets the plugin priority; larger means first.

Property Details

$authUrl

protected string $authUrl

$service

protected Service $service

Method Details

__construct

public function __construct(Service $service, string $authUrl)

Creates a new AuthPlugin.

Parameters
NameTypeDescription
$serviceService

The auth service

$authUrlstring

The URL for the standalone login form

__invoke

public function __invoke(ServerRequestInterface $request, ResponseInterface $response, (function(Request,Response):Response) $next)

Allows a plugin to issue a response before the request is dispatched.

Parameters
NameTypeDescription
$requestServerRequestInterface

The server request

$responseResponseInterface

The response

$next(function(Request,Response):Response)
Returns
TypeDescription
ResponseInterface

The response

getPriority

public function getPriority()

Gets the plugin priority; larger means first.

Returns
TypeDescription
int

The plugin priority