class GuardAuthenticatorHandler

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.

Methods

__construct(TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher = null, array $statelessProviderKeys = [])

No description

authenticateWithToken(TokenInterface $token, Request $request)

Authenticates the given token in the system.

Response|null
handleAuthenticationSuccess(TokenInterface $token, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey)

Returns the "on success" response for the given GuardAuthenticator.

Response|null
authenticateUserAndHandleSuccess(UserInterface $user, Request $request, AuthenticatorInterface $authenticator, string $providerKey)

Convenience method for authenticating the user and returning the Response if any for success.

Response|null
handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey)

Handles an authentication failure and returns the Response for the GuardAuthenticator.

setSessionAuthenticationStrategy(SessionAuthenticationStrategyInterface $sessionStrategy)

Call this method if your authentication token is stored to a session.

Details

at line 45
__construct(TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher = null, array $statelessProviderKeys = [])

Parameters

TokenStorageInterface $tokenStorage
EventDispatcherInterface $eventDispatcher
array $statelessProviderKeys

at line 57
authenticateWithToken(TokenInterface $token, Request $request)

Authenticates the given token in the system.

Parameters

TokenInterface $token
Request $request

at line 73
Response|null handleAuthenticationSuccess(TokenInterface $token, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey)

Returns the "on success" response for the given GuardAuthenticator.

Parameters

TokenInterface $token
Request $request
AuthenticatorInterface $guardAuthenticator
string $providerKey

Return Value

Response|null

at line 89
Response|null authenticateUserAndHandleSuccess(UserInterface $user, Request $request, AuthenticatorInterface $authenticator, string $providerKey)

Convenience method for authenticating the user and returning the Response if any for success.

Parameters

UserInterface $user
Request $request
AuthenticatorInterface $authenticator
string $providerKey

Return Value

Response|null

at line 104
Response|null handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, AuthenticatorInterface $guardAuthenticator, string $providerKey)

Handles an authentication failure and returns the Response for the GuardAuthenticator.

Parameters

AuthenticationException $authenticationException
Request $request
AuthenticatorInterface $guardAuthenticator
string $providerKey

Return Value

Response|null

at line 120
setSessionAuthenticationStrategy(SessionAuthenticationStrategyInterface $sessionStrategy)

Call this method if your authentication token is stored to a session.

Parameters

SessionAuthenticationStrategyInterface $sessionStrategy