mediatekformation

TokenBasedRememberMeServices extends AbstractRememberMeServices
in package

Concrete implementation of the RememberMeServicesInterface providing remember-me capabilities without requiring a TokenProvider.

Tags
author

Johannes M. Schmitt schmittjoh@gmail.com

Table of Contents

COOKIE_DELIMITER  = ':'
$logger  : mixed
$options  : mixed
$providerKey  : mixed
$secret  : mixed
$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.
cancelCookie()  : mixed
Deletes the remember-me cookie.
decodeCookie()  : array<string|int, mixed>
Decodes the raw cookie value.
encodeCookie()  : string
Encodes the cookie parts.
generateCookieHash()  : string
Generates a hash for the cookie to ensure it is not being tampered with.
generateCookieValue()  : string
Generates the cookie value.
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

Properties

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
throws
InvalidArgumentException
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
throws
CookieTheftException
throws
RuntimeException
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

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

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
throws
InvalidArgumentException

When $cookieParts contain the cookie delimiter. Extending class should either remove or escape it.

Return values
string

generateCookieHash()

Generates a hash for the cookie to ensure it is not being tampered with.

protected generateCookieHash(string $class, string $username, int $expires, string|null $password) : string
Parameters
$class : string
$username : string

The username

$expires : int

The Unix timestamp when the cookie expires

$password : string|null

The encoded password

Return values
string

generateCookieValue()

Generates the cookie value.

protected generateCookieValue(string $class, string $username, int $expires, string|null $password) : string
Parameters
$class : string
$username : string

The username

$expires : int

The Unix timestamp when the cookie expires

$password : string|null

The encoded password

Return values
string

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
Return values
UserInterface

Search results