DefaultAuthenticationSuccessHandler
in package
implements
AuthenticationSuccessHandlerInterface
Uses
TargetPathTrait
Class with the default authentication success handling logic.
Tags
Interfaces, Classes, Traits and Enums
- AuthenticationSuccessHandlerInterface
- Interface for a custom authentication success handler.
Table of Contents
- $defaultOptions : mixed
- $httpUtils : mixed
- $options : mixed
- $providerKey : mixed
- __construct() : mixed
- getOptions() : array<string|int, mixed>
- Gets the options.
- getProviderKey() : string
- Get the provider key.
- onAuthenticationSuccess() : Response
- This is called when an interactive authentication attempt succeeds. This is called by authentication listeners inheriting from AbstractAuthenticationListener.
- setOptions() : mixed
- setProviderKey() : mixed
- Set the provider key.
- determineTargetUrl() : string
- Builds the target URL according to the defined options.
- 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.
Properties
$defaultOptions
protected
mixed
$defaultOptions
= ['always_use_default_target_path' => false, 'default_target_path' => '/', 'login_path' => '/login', 'target_path_parameter' => '_target_path', 'use_referer' => false]
$httpUtils
protected
mixed
$httpUtils
$options
protected
mixed
$options
$providerKey
protected
mixed
$providerKey
Methods
__construct()
public
__construct(HttpUtils $httpUtils[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $httpUtils : HttpUtils
- $options : array<string|int, mixed> = []
-
Options for processing a successful authentication attempt
Return values
mixed —getOptions()
Gets the options.
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of options
getProviderKey()
Get the provider key.
public
getProviderKey() : string
Return values
string —onAuthenticationSuccess()
This is called when an interactive authentication attempt succeeds. This is called by authentication listeners inheriting from AbstractAuthenticationListener.
public
onAuthenticationSuccess(Request $request, TokenInterface $token) : Response
Parameters
- $request : Request
- $token : TokenInterface
Return values
Response —setOptions()
public
setOptions(array<string|int, mixed> $options) : mixed
Parameters
- $options : array<string|int, mixed>
Return values
mixed —setProviderKey()
Set the provider key.
public
setProviderKey(string $providerKey) : mixed
Parameters
- $providerKey : string
Return values
mixed —determineTargetUrl()
Builds the target URL according to the defined options.
protected
determineTargetUrl(Request $request) : string
Parameters
- $request : Request
Return values
string —getTargetPath()
Returns the URL (if any) the user visited that forced them to login.
private
getTargetPath(SessionInterface $session, string $providerKey) : string|null
Parameters
- $session : SessionInterface
- $providerKey : string
Return values
string|null —removeTargetPath()
Removes the target path from the session.
private
removeTargetPath(SessionInterface $session, string $providerKey) : mixed
Parameters
- $session : SessionInterface
- $providerKey : string
Return values
mixed —saveTargetPath()
Sets the target path the user should be redirected to after authentication.
private
saveTargetPath(SessionInterface $session, string $providerKey, string $uri) : mixed
Usually, you do not need to set this directly.
Parameters
- $session : SessionInterface
- $providerKey : string
- $uri : string