DoctrineTokenProvider
in package
implements
TokenProviderInterface, TokenVerifierInterface
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
);
Table of Contents
Interfaces
- TokenProviderInterface
- Interface for TokenProviders.
- TokenVerifierInterface
Properties
- $conn : mixed
Methods
- __construct() : mixed
- configureSchema() : void
- Adds the Table to the Schema if "remember me" uses this Connection.
- createNewToken() : mixed
- Creates a new token.
- deleteTokenBySeries() : mixed
- Deletes all tokens belonging to series.
- loadTokenBySeries() : PersistentTokenInterface
- Loads the active token for the given series.
- updateExistingToken() : void
- Updates an existing token with a new token value and lastUsed time.
- updateToken() : mixed
- Updates the token according to this data.
- verifyToken() : bool
- Verifies that the given $token is valid.
- addTableToSchema() : void
Properties
$conn
private
mixed
$conn
Methods
__construct()
public
__construct(Connection $conn) : mixed
Parameters
- $conn : Connection
configureSchema()
Adds the Table to the Schema if "remember me" uses this Connection.
public
configureSchema(Schema $schema, Connection $forConnection) : void
Parameters
- $schema : Schema
- $forConnection : Connection
createNewToken()
Creates a new token.
public
createNewToken(PersistentTokenInterface $token) : mixed
Parameters
- $token : PersistentTokenInterface
deleteTokenBySeries()
Deletes all tokens belonging to series.
public
deleteTokenBySeries(string $series) : mixed
Parameters
- $series : string
loadTokenBySeries()
Loads the active token for the given series.
public
loadTokenBySeries(string $series) : PersistentTokenInterface
Parameters
- $series : string
Return values
PersistentTokenInterfaceupdateExistingToken()
Updates an existing token with a new token value and lastUsed time.
public
updateExistingToken(PersistentTokenInterface $token, string $tokenValue, DateTimeInterface $lastUsed) : void
Parameters
- $token : PersistentTokenInterface
- $tokenValue : string
- $lastUsed : DateTimeInterface
updateToken()
Updates the token according to this data.
public
updateToken(string $series, string $tokenValue, DateTime $lastUsed) : mixed
Parameters
- $series : string
- $tokenValue : string
- $lastUsed : DateTime
verifyToken()
Verifies that the given $token is valid.
public
verifyToken(PersistentTokenInterface $token, string $tokenValue) : bool
Parameters
- $token : PersistentTokenInterface
- $tokenValue : string
Return values
booladdTableToSchema()
private
addTableToSchema(Schema $schema) : void
Parameters
- $schema : Schema