GuardAuthenticatorHandler
in package
A utility class that does much of the *work* during the guard authentication process.
By having the logic here instead of the listener, more of the process can be called directly (e.g. for manual authentication) or overridden.
Tags
Table of Contents
- $dispatcher : mixed
- $sessionStrategy : mixed
- $statelessProviderKeys : mixed
- $tokenStorage : mixed
- __construct() : mixed
- authenticateUserAndHandleSuccess() : Response|null
- Convenience method for authenticating the user and returning the Response *if any* for success.
- authenticateWithToken() : mixed
- Authenticates the given token in the system.
- handleAuthenticationFailure() : Response|null
- Handles an authentication failure and returns the Response for the GuardAuthenticator.
- handleAuthenticationSuccess() : Response|null
- Returns the "on success" response for the given GuardAuthenticator.
- setSessionAuthenticationStrategy() : mixed
- Call this method if your authentication token is stored to a session.
- migrateSession() : mixed
Properties
$dispatcher
private
mixed
$dispatcher
$sessionStrategy
private
mixed
$sessionStrategy
$statelessProviderKeys
private
mixed
$statelessProviderKeys
$tokenStorage
private
mixed
$tokenStorage
Methods
__construct()
public
__construct(TokenStorageInterface $tokenStorage[, EventDispatcherInterface $eventDispatcher = null ][, array<string|int, mixed> $statelessProviderKeys = [] ]) : mixed
Parameters
- $tokenStorage : TokenStorageInterface
- $eventDispatcher : EventDispatcherInterface = null
- $statelessProviderKeys : array<string|int, mixed> = []
-
An array of provider/firewall keys that are "stateless" and so do not need the session migrated on success
Return values
mixed —authenticateUserAndHandleSuccess()
Convenience method for authenticating the user and returning the Response *if any* for success.
public
authenticateUserAndHandleSuccess(UserInterface $user, Request $request, AuthenticatorInterface $authenticator, string $providerKey) : Response|null
Parameters
- $user : UserInterface
- $request : Request
- $authenticator : AuthenticatorInterface
- $providerKey : string
Return values
Response|null —authenticateWithToken()
Authenticates the given token in the system.
public
authenticateWithToken(TokenInterface $token, Request $request[, string $providerKey = null ]) : mixed
Parameters
- $token : TokenInterface
- $request : Request
- $providerKey : string = null
Return values
mixed —handleAuthenticationFailure()
Handles an authentication failure and returns the Response for the GuardAuthenticator.
public
handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey) : Response|null
Parameters
- $authenticationException : AuthenticationException
- $request : Request
- $guardAuthenticator : AuthenticatorInterface
- $providerKey : string
Return values
Response|null —handleAuthenticationSuccess()
Returns the "on success" response for the given GuardAuthenticator.
public
handleAuthenticationSuccess(TokenInterface $token, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey) : Response|null
Parameters
- $token : TokenInterface
- $request : Request
- $guardAuthenticator : AuthenticatorInterface
- $providerKey : string
Return values
Response|null —setSessionAuthenticationStrategy()
Call this method if your authentication token is stored to a session.
public
setSessionAuthenticationStrategy(SessionAuthenticationStrategyInterface $sessionStrategy) : mixed
Parameters
- $sessionStrategy : SessionAuthenticationStrategyInterface
Tags
Return values
mixed —migrateSession()
private
migrateSession(Request $request, TokenInterface $token, string|null $providerKey) : mixed
Parameters
- $request : Request
- $token : TokenInterface
- $providerKey : string|null