Class AuthenticationMiddleware
Authentication Middleware
Namespace: Authentication\Middleware
Property Summary
-
$container protected
Cake\Core\ContainerInterface|null
The container instance from the application
-
$subject protected
Authentication\AuthenticationServiceInterfaceAuthentication\AuthenticationServiceProviderInterface
Authentication service or application instance.
Method Summary
-
__construct() public
Constructor
-
getAuthenticationService() protected
Returns AuthenticationServiceInterface instance.
-
process() public
Callable implementation for the middleware stack.
Method Detail
__construct() ¶ public
__construct(Authentication\AuthenticationServiceInterfaceAuthentication\AuthenticationServiceProviderInterface $subject, Cake\Core\ContainerInterface|null $container = null)
Constructor
Parameters
-
Authentication\AuthenticationServiceInterfaceAuthentication\AuthenticationServiceProviderInterface
$subject Authentication service or application instance.
-
Cake\Core\ContainerInterface|null
$container optional The container instance from the application.
getAuthenticationService() ¶ protected
getAuthenticationService(Psr\Http\Message\ServerRequestInterface $request): Authentication\AuthenticationServiceInterface
Returns AuthenticationServiceInterface instance.
Parameters
-
Psr\Http\Message\ServerRequestInterface
$request Server request.
Returns
Authentication\AuthenticationServiceInterface
Throws
RuntimeException
When authentication method has not been defined.
process() ¶ public
process(ServerRequestInterface $request, RequestHandlerInterface $handler): Psr\Http\Message\ResponseInterface
Callable implementation for the middleware stack.
Processes an incoming server request in order to produce a response. If unable to produce the response itself, it may delegate to the provided request handler to do so.
Parameters
-
ServerRequestInterface
$request The request.
-
RequestHandlerInterface
$handler The request handler.
Returns
Psr\Http\Message\ResponseInterface