abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator

A base class to make form login authentication easier!

Methods

createAuthenticatedToken(UserInterface $user, string $providerKey)

Shortcut to create a PostAuthenticationGuardToken for you, if you don't really care about which authenticated token you're using.

string
getLoginUrl()

Return the URL to the login page.

string
getDefaultSuccessRedirectUrl()

The user will be redirected to the secure page they originally tried to access. But if no such page exists (i.e. the user went to the login page directly), this returns the URL the user should be redirected to after logging in successfully (e.g. your homepage).

Response|null
onAuthenticationFailure(Request $request, AuthenticationException $exception)

Override to change what happens after a bad username/password is submitted.

Response|null
onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey)

Override to change what happens after successful authentication.

bool
supportsRememberMe()

Does this method support remember me cookies?

start(Request $request, AuthenticationException $authException = null)

Override to control what happens when the user hits a secure page but isn't logged in yet.

Details

GuardTokenInterface createAuthenticatedToken(UserInterface $user, string $providerKey)

Shortcut to create a PostAuthenticationGuardToken for you, if you don't really care about which authenticated token you're using.

Parameters

UserInterface $user
string $providerKey The provider (i.e. firewall) key

Return Value

GuardTokenInterface

at line 34
abstract protected string getLoginUrl()

Return the URL to the login page.

Return Value

string

at line 44
abstract protected string getDefaultSuccessRedirectUrl()

The user will be redirected to the secure page they originally tried to access. But if no such page exists (i.e. the user went to the login page directly), this returns the URL the user should be redirected to after logging in successfully (e.g. your homepage).

Return Value

string

at line 54
Response|null onAuthenticationFailure(Request $request, AuthenticationException $exception)

Override to change what happens after a bad username/password is submitted.

Parameters

Request $request
AuthenticationException $exception

Return Value

Response|null

at line 74
Response|null onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey)

Override to change what happens after successful authentication.

Parameters

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

Return Value

Response|null

at line 91
bool supportsRememberMe()

Does this method support remember me cookies?

Remember me cookie will be set if all of the following are met: A) This method returns true B) The remember_me key under your firewall is configured C) The "remember me" functionality is activated. This is usually done by having a _remember_me checkbox in your form, but can be configured by the "always_remember_me" and "remember_me_parameter" parameters under the "remember_me" firewall key D) The onAuthenticationSuccess method returns a Response object

Return Value

bool

at line 105
Response start(Request $request, AuthenticationException $authException = null)

Override to control what happens when the user hits a secure page but isn't logged in yet.

Parameters

Request $request The request that resulted in an AuthenticationException
AuthenticationException $authException The exception that started the authentication process

Return Value

Response