PersistentTokenBasedRememberMeServices
extends AbstractRememberMeServices
in package
Concrete implementation of the RememberMeServicesInterface which needs an implementation of TokenProviderInterface for providing remember-me capabilities.
Tags
Table of Contents
- COOKIE_DELIMITER = ':'
- $logger : mixed
- $options : mixed
- $providerKey : mixed
- $secret : mixed
- $tokenProvider : TokenProviderInterface
- $userProviders : mixed
- __construct() : mixed
- autoLogin() : TokenInterface|null
- Implementation of RememberMeServicesInterface. Detects whether a remember-me cookie was set, decodes it, and hands it to subclasses for further processing.
- getRememberMeParameter() : string
- Returns the parameter that is used for checking whether remember-me services have been requested.
- getSecret() : string
- loginFail() : mixed
- Implementation for RememberMeServicesInterface. Deletes the cookie when an attempted authentication fails.
- loginSuccess() : mixed
- Implementation for RememberMeServicesInterface. This is called when an authentication is successful.
- logout() : mixed
- Implementation for LogoutHandlerInterface. Deletes the cookie.
- setTokenProvider() : mixed
- cancelCookie() : mixed
- Deletes the remember-me cookie.
- decodeCookie() : array<string|int, mixed>
- Decodes the raw cookie value.
- encodeCookie() : string
- Encodes the cookie parts.
- getUserProvider() : UserProviderInterface
- isRememberMeRequested() : bool
- Checks whether remember-me capabilities were requested.
- onLoginFail() : mixed
- onLoginSuccess() : mixed
- This is called after a user has been logged in successfully, and has requested remember-me capabilities. The implementation usually sets a cookie and possibly stores a persistent record of it.
- processAutoLoginCookie() : UserInterface
- Subclasses should validate the cookie and do any additional processing that is required. This is called from autoLogin().
Constants
COOKIE_DELIMITER
public
mixed
COOKIE_DELIMITER
= ':'
Properties
$logger
protected
mixed
$logger
$options
protected
mixed
$options
= ['secure' => false, 'httponly' => true, 'samesite' => null]
$providerKey
private
mixed
$providerKey
$secret
private
mixed
$secret
$tokenProvider
private
TokenProviderInterface
$tokenProvider
$userProviders
private
mixed
$userProviders
Methods
__construct()
public
__construct(array<string|int, mixed> $userProviders, string $secret, string $providerKey[, array<string|int, mixed> $options = [] ][, LoggerInterface $logger = null ]) : mixed
Parameters
- $userProviders : array<string|int, mixed>
- $secret : string
- $providerKey : string
- $options : array<string|int, mixed> = []
- $logger : LoggerInterface = null
Tags
Return values
mixed —autoLogin()
Implementation of RememberMeServicesInterface. Detects whether a remember-me cookie was set, decodes it, and hands it to subclasses for further processing.
public
final autoLogin(Request $request) : TokenInterface|null
Parameters
- $request : Request
Tags
Return values
TokenInterface|null —getRememberMeParameter()
Returns the parameter that is used for checking whether remember-me services have been requested.
public
getRememberMeParameter() : string
Return values
string —getSecret()
public
getSecret() : string
Return values
string —loginFail()
Implementation for RememberMeServicesInterface. Deletes the cookie when an attempted authentication fails.
public
final loginFail(Request $request[, Exception $exception = null ]) : mixed
Parameters
- $request : Request
- $exception : Exception = null
Return values
mixed —loginSuccess()
Implementation for RememberMeServicesInterface. This is called when an authentication is successful.
public
final loginSuccess(Request $request, Response $response, TokenInterface $token) : mixed
Parameters
- $request : Request
- $response : Response
- $token : TokenInterface
Return values
mixed —logout()
Implementation for LogoutHandlerInterface. Deletes the cookie.
public
logout(Request $request, Response $response, TokenInterface $token) : mixed
Parameters
- $request : Request
- $response : Response
- $token : TokenInterface
Return values
mixed —setTokenProvider()
public
setTokenProvider(TokenProviderInterface $tokenProvider) : mixed
Parameters
- $tokenProvider : TokenProviderInterface
Return values
mixed —cancelCookie()
Deletes the remember-me cookie.
protected
cancelCookie(Request $request) : mixed
Parameters
- $request : Request
Return values
mixed —decodeCookie()
Decodes the raw cookie value.
protected
decodeCookie(string $rawCookie) : array<string|int, mixed>
Parameters
- $rawCookie : string
Return values
array<string|int, mixed> —encodeCookie()
Encodes the cookie parts.
protected
encodeCookie(array<string|int, mixed> $cookieParts) : string
Parameters
- $cookieParts : array<string|int, mixed>
Tags
Return values
string —getUserProvider()
protected
final getUserProvider(string $class) : UserProviderInterface
Parameters
- $class : string
Return values
UserProviderInterface —isRememberMeRequested()
Checks whether remember-me capabilities were requested.
protected
isRememberMeRequested(Request $request) : bool
Parameters
- $request : Request
Return values
bool —onLoginFail()
protected
onLoginFail(Request $request[, Exception $exception = null ]) : mixed
Parameters
- $request : Request
- $exception : Exception = null
Return values
mixed —onLoginSuccess()
This is called after a user has been logged in successfully, and has requested remember-me capabilities. The implementation usually sets a cookie and possibly stores a persistent record of it.
protected
onLoginSuccess(Request $request, Response $response, TokenInterface $token) : mixed
Parameters
- $request : Request
- $response : Response
- $token : TokenInterface
Return values
mixed —processAutoLoginCookie()
Subclasses should validate the cookie and do any additional processing that is required. This is called from autoLogin().
protected
processAutoLoginCookie(array<string|int, mixed> $cookieParts, Request $request) : UserInterface
Parameters
- $cookieParts : array<string|int, mixed>
- $request : Request