class RememberMeToken extends AbstractToken

Authentication Token for "Remember-Me".

Methods

__construct(UserInterface $user, string $providerKey, string $secret)

No description

Role[]
getRoles()

Returns the user roles.

string
getUsername()

Returns the username.

string|object
getUser()

Returns a user representation.

setUser(string|object $user)

Sets the user in the token.

bool
isAuthenticated()

Returns whether the user is authenticated or not.

setAuthenticated($authenticated)

Sets the authenticated flag.

eraseCredentials()

Removes sensitive information from the token.

serialize()

{@inheritdoc}

unserialize($serialized)

{@inheritdoc}

array
getState()

Returns all the necessary state of the object for serialization purposes.

setState(array $data)

Restores the object state from an array given by getState().

array
getAttributes()

Returns the token attributes.

setAttributes(array $attributes)

Sets the token attributes.

bool
hasAttribute(string $name)

Returns true if the attribute exists.

mixed
getAttribute(string $name)

Returns an attribute value.

setAttribute(string $name, mixed $value)

Sets an attribute.

string
__toString()

Returns a string representation of the Token.

doSerialize($serialized, $isCalledFromOverridingMethod)

No description

string
getProviderKey()

Returns the provider secret.

string
getSecret()

Returns the secret.

mixed
getCredentials()

Returns the user credentials.

Details

at line 33
__construct(UserInterface $user, string $providerKey, string $secret)

Parameters

UserInterface $user
string $providerKey
string $secret A secret used to make sure the token is created by the app and not by a malicious client

Exceptions

InvalidArgumentException

in AbstractToken at line 53
Role[] getRoles()

Returns the user roles.

Return Value

Role[] An array of Role instances

in AbstractToken at line 61
string getUsername()

Returns the username.

Return Value

string

in AbstractToken at line 73
string|object getUser()

Returns a user representation.

Return Value

string|object Can be a UserInterface instance, an object implementing a __toString method, or the username as a regular string

in AbstractToken at line 81
setUser(string|object $user)

Sets the user in the token.

The user can be a UserInterface instance, or an object implementing a __toString method or the username as a regular string.

Parameters

string|object $user The user

Exceptions

InvalidArgumentException

in AbstractToken at line 111
bool isAuthenticated()

Returns whether the user is authenticated or not.

Return Value

bool true if the token has been authenticated, false otherwise

at line 55
setAuthenticated($authenticated)

Sets the authenticated flag.

Parameters

$authenticated

in AbstractToken at line 127
eraseCredentials()

Removes sensitive information from the token.

in AbstractToken at line 141
serialize()

{@inheritdoc}

in AbstractToken at line 153
unserialize($serialized)

{@inheritdoc}

Parameters

$serialized

at line 95
protected array getState()

Returns all the necessary state of the object for serialization purposes.

There is no need to serialize any entry, they should be returned as-is. If you extend this method, keep in mind you MUST guarantee parent data is present in the state. Here is an example of how to extend this method: protected function getState(): array { return [$this->childAttribute, parent::getState()]; }

Return Value

array

at line 103
protected setState(array $data)

Restores the object state from an array given by getState().

There is no need to unserialize any entry in $data, they are already ready-to-use. If you extend this method, keep in mind you MUST pass the parent data to its respective class. Here is an example of how to extend this method: protected function setState(array $data) { [$this->childAttribute, $parentData] = $data; parent::setState($parentData); }

Parameters

array $data

in AbstractToken at line 204
array getAttributes()

Returns the token attributes.

Return Value

array The token attributes

in AbstractToken at line 214
setAttributes(array $attributes)

Sets the token attributes.

Parameters

array $attributes The token attributes

in AbstractToken at line 226
bool hasAttribute(string $name)

Returns true if the attribute exists.

Parameters

string $name The attribute name

Return Value

bool true if the attribute exists, false otherwise

in AbstractToken at line 240
mixed getAttribute(string $name)

Returns an attribute value.

Parameters

string $name The attribute name

Return Value

mixed The attribute value

Exceptions

InvalidArgumentException When attribute doesn't exist for this token

in AbstractToken at line 255
setAttribute(string $name, mixed $value)

Sets an attribute.

Parameters

string $name The attribute name
mixed $value The attribute value

in AbstractToken at line 263
string __toString()

Returns a string representation of the Token.

This is only to be used for debugging purposes.

Return Value

string

in AbstractToken at line 279
protected doSerialize($serialized, $isCalledFromOverridingMethod)

Parameters

$serialized
$isCalledFromOverridingMethod

at line 69
string getProviderKey()

Returns the provider secret.

Return Value

string The provider secret

at line 79
string getSecret()

Returns the secret.

Return Value

string

at line 87
mixed getCredentials()

Returns the user credentials.

Return Value

mixed The user credentials