AppCustomAuthenticator
extends AbstractLoginFormAuthenticator
in package
Uses
TargetPathTrait
A base class to make form login authentication easier!
Table of Contents
Constants
- LOGIN_ROUTE = 'app_login'
Properties
Methods
- __construct() : mixed
- authenticate() : Passport
- createToken() : TokenInterface
- Shortcut to create a PostAuthenticationToken for you, if you don't really care about which authenticated token you're using.
- isInteractive() : bool
- Should return true to make this authenticator perform an interactive login.
- onAuthenticationFailure() : Response
- Override to change what happens after a bad username/password is submitted.
- onAuthenticationSuccess() : Response|null
- start() : Response
- Override to control what happens when the user hits a secure page but isn't logged in yet.
- supports() : bool
- {@inheritdoc}
- getLoginUrl() : string
- Return the URL to the login page.
- getTargetPath() : string|null
- Returns the URL (if any) the user visited that forced them to login.
- removeTargetPath() : mixed
- Removes the target path from the session.
- saveTargetPath() : mixed
- Sets the target path the user should be redirected to after authentication.
Constants
LOGIN_ROUTE
public
mixed
LOGIN_ROUTE
= 'app_login'
Properties
$urlGenerator
private
UrlGeneratorInterface
$urlGenerator
Methods
__construct()
public
__construct(UrlGeneratorInterface $urlGenerator) : mixed
Parameters
- $urlGenerator : UrlGeneratorInterface
authenticate()
public
authenticate(Request $request) : Passport
Parameters
- $request : Request
Return values
PassportcreateToken()
Shortcut to create a PostAuthenticationToken for you, if you don't really care about which authenticated token you're using.
public
createToken(Passport $passport, string $firewallName) : TokenInterface
Parameters
- $passport : Passport
-
The passport returned from authenticate()
- $firewallName : string
Return values
TokenInterfaceisInteractive()
Should return true to make this authenticator perform an interactive login.
public
isInteractive() : bool
Return values
boolonAuthenticationFailure()
Override to change what happens after a bad username/password is submitted.
public
onAuthenticationFailure(Request $request, AuthenticationException $exception) : Response
Parameters
- $request : Request
- $exception : AuthenticationException
Return values
ResponseonAuthenticationSuccess()
public
onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName) : Response|null
Parameters
- $request : Request
- $token : TokenInterface
- $firewallName : string
Return values
Response|nullstart()
Override to control what happens when the user hits a secure page but isn't logged in yet.
public
start(Request $request[, AuthenticationException $authException = null ]) : Response
Parameters
- $request : Request
- $authException : AuthenticationException = null
Return values
Responsesupports()
{@inheritdoc}
public
supports(Request $request) : bool
Override to change the request conditions that have to be matched in order to handle the login form submit.
This default implementation handles all POST requests to the login path (@see getLoginUrl()).
Parameters
- $request : Request
Return values
boolgetLoginUrl()
Return the URL to the login page.
protected
getLoginUrl(Request $request) : string
Parameters
- $request : Request
Return values
stringgetTargetPath()
Returns the URL (if any) the user visited that forced them to login.
private
getTargetPath(SessionInterface $session, string $firewallName) : string|null
Parameters
- $session : SessionInterface
- $firewallName : string
Return values
string|nullremoveTargetPath()
Removes the target path from the session.
private
removeTargetPath(SessionInterface $session, string $firewallName) : mixed
Parameters
- $session : SessionInterface
- $firewallName : string
saveTargetPath()
Sets the target path the user should be redirected to after authentication.
private
saveTargetPath(SessionInterface $session, string $firewallName, string $uri) : mixed
Usually, you do not need to set this directly.
Parameters
- $session : SessionInterface
- $firewallName : string
- $uri : string