TokenBasedRememberMeServices
class TokenBasedRememberMeServices extends AbstractRememberMeServices
Concrete implementation of the RememberMeServicesInterface providing remember-me capabilities without requiring a TokenProvider.
Constants
Properties
Methods
| __construct(array $userProviders, string $secret, string $providerKey, array $options = array(), LoggerInterface $logger = null) | from AbstractRememberMeServices |
string | getRememberMeParameter() Returns the parameter that is used for checking whether remember-me services have been requested. | from AbstractRememberMeServices |
string | getSecret() | from AbstractRememberMeServices |
TokenInterface | autoLogin(Request $request) Implementation of RememberMeServicesInterface. Detects whether a remember-me cookie was set, decodes it, and hands it to subclasses for further processing. | from AbstractRememberMeServices |
| logout(Request $request, Response $response, TokenInterface $token) Implementation for LogoutHandlerInterface. Deletes the cookie. | from AbstractRememberMeServices |
| loginFail(Request $request, Exception $exception = null) Implementation for RememberMeServicesInterface. Deletes the cookie when an attempted authentication fails. | from AbstractRememberMeServices |
| loginSuccess(Request $request, Response $response, TokenInterface $token) Implementation for RememberMeServicesInterface. This is called when an authentication is successful. | from AbstractRememberMeServices |
UserInterface | processAutoLoginCookie(array $cookieParts, Request $request) Subclasses should validate the cookie and do any additional processing that is required. This is called from autoLogin(). | |
| onLoginFail(Request $request, Exception $exception = null) | from AbstractRememberMeServices |
| onLoginSuccess(Request $request, Response $response, TokenInterface $token) 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. | |
| getUserProvider($class) | from AbstractRememberMeServices |
array | decodeCookie(string $rawCookie) Decodes the raw cookie value. | from AbstractRememberMeServices |
string | encodeCookie(array $cookieParts) Encodes the cookie parts. | from AbstractRememberMeServices |
| cancelCookie(Request $request) Deletes the remember-me cookie. | from AbstractRememberMeServices |
bool | isRememberMeRequested(Request $request) Checks whether remember-me capabilities were requested. | from AbstractRememberMeServices |
string | generateCookieValue(string $class, string $username, int $expires, string $password) Generates the cookie value. | |
string | generateCookieHash(string $class, string $username, int $expires, string $password) Generates a hash for the cookie to ensure it is not being tempered with. | |
Details
__construct(array $userProviders, string $secret, string $providerKey, array $options = array(), LoggerInterface $logger = null)
Parameters
array | $userProviders | |
string | $secret | |
string | $providerKey | |
array | $options | |
LoggerInterface | $logger | |
Exceptions
string
getRememberMeParameter()
Returns the parameter that is used for checking whether remember-me services have been requested.
Return Value
string
getSecret()
Return Value
Implementation of RememberMeServicesInterface. Detects whether a remember-me cookie was set, decodes it, and hands it to subclasses for further processing.
Parameters
Return Value
Exceptions
Implementation for LogoutHandlerInterface. Deletes the cookie.
Parameters
final
loginFail(Request $request, Exception $exception = null)
Implementation for RememberMeServicesInterface. Deletes the cookie when an attempted authentication fails.
Parameters
Implementation for RememberMeServicesInterface. This is called when an authentication is successful.
Parameters
protected UserInterface
processAutoLoginCookie(array $cookieParts, Request $request)
Subclasses should validate the cookie and do any additional processing that is required. This is called from autoLogin().
Parameters
array | $cookieParts | |
Request | $request | |
Return Value
protected
onLoginFail(Request $request, Exception $exception = null)
Parameters
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.
Parameters
final protected
getUserProvider($class)
Parameters
protected array
decodeCookie(string $rawCookie)
Decodes the raw cookie value.
Parameters
Return Value
protected string
encodeCookie(array $cookieParts)
Encodes the cookie parts.
Parameters
Return Value
Exceptions
InvalidArgumentException | When $cookieParts contain the cookie delimiter. Extending class should either remove or escape it. |
protected
cancelCookie(Request $request)
Deletes the remember-me cookie.
Parameters
protected bool
isRememberMeRequested(Request $request)
Checks whether remember-me capabilities were requested.
Parameters
Return Value
protected string
generateCookieValue(string $class, string $username, int $expires, string $password)
Generates the cookie value.
Parameters
string | $class | |
string | $username | The username |
int | $expires | The Unix timestamp when the cookie expires |
string | $password | The encoded password |
Return Value
protected string
generateCookieHash(string $class, string $username, int $expires, string $password)
Generates a hash for the cookie to ensure it is not being tempered with.
Parameters
string | $class | |
string | $username | The username |
int | $expires | The Unix timestamp when the cookie expires |
string | $password | The encoded password |
Return Value