DoctrineTokenProvider

class DoctrineTokenProvider implements TokenProviderInterface

This class provides storage for the tokens that is set in "remember me" cookies. This way no password secrets will be stored in the cookies on the client machine, and thus the security is improved.

This depends only on doctrine in order to get a database connection and to do the conversion of the datetime column.

In order to use this class, you need the following table in your database: CREATE TABLE rememberme_token ( series char(88) UNIQUE PRIMARY KEY NOT NULL, value char(88) NOT NULL, lastUsed datetime NOT NULL, class varchar(100) NOT NULL, username varchar(200) NOT NULL );

Methods

__construct(Connection $conn)
PersistentTokenInterface loadTokenBySeries(string $series)

Loads the active token for the given series.

deleteTokenBySeries(string $series)

Deletes all tokens belonging to series.

updateToken(string $series, string $tokenValue, DateTime $lastUsed)

Updates the token according to this data.

createNewToken(PersistentTokenInterface $token)

Creates a new token.

Details

__construct(Connection $conn)

Parameters

Connection $conn

PersistentTokenInterface loadTokenBySeries(string $series)

Loads the active token for the given series.

Parameters

string $series

Return Value

PersistentTokenInterface

Exceptions

TokenNotFoundException if the token is not found

deleteTokenBySeries(string $series)

Deletes all tokens belonging to series.

Parameters

string $series

updateToken(string $series, string $tokenValue, DateTime $lastUsed)

Updates the token according to this data.

Parameters

string $series
string $tokenValue
DateTime $lastUsed

Exceptions

TokenNotFoundException if the token is not found

createNewToken(PersistentTokenInterface $token)

Creates a new token.

Parameters

PersistentTokenInterface $token

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.7/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.html