GuardAuthenticatorHandler

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)
authenticateWithToken(TokenInterface $token, Request $request)

Authenticates the given token in the system.

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

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

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

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

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

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

Details

__construct(TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher = null)

Parameters

TokenStorageInterface $tokenStorage
EventDispatcherInterface $eventDispatcher

authenticateWithToken(TokenInterface $token, Request $request)

Authenticates the given token in the system.

Parameters

TokenInterface $token
Request $request

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

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

Parameters

TokenInterface $token
Request $request
GuardAuthenticatorInterface $guardAuthenticator
string $providerKey The provider (i.e. firewall) key

Return Value

null|Response

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

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

Parameters

UserInterface $user
Request $request
GuardAuthenticatorInterface $authenticator
string $providerKey The provider (i.e. firewall) key

Return Value

Response|null

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

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

Parameters

AuthenticationException $authenticationException
Request $request
GuardAuthenticatorInterface $guardAuthenticator
string $providerKey The key of the firewall

Return Value

null|Response

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.html