class SessionTokenStorage implements ClearableTokenStorageInterface
Token storage that uses a Symfony Session object.
SESSION_NAMESPACE | The namespace used to store values in the session. |
__construct(SessionInterface $session, string $namespace = self::SESSION_NAMESPACE) Initializes the storage with a Session object and a session namespace. | ||
string | getToken(string $tokenId) Reads a stored CSRF token. | |
setToken(string $tokenId, string $token) Stores a CSRF token. | ||
bool | hasToken(string $tokenId) Checks whether a token with the given token ID exists. | |
string|null | removeToken(string $tokenId) Removes a CSRF token. | |
clear() Removes all CSRF tokens. |
Initializes the storage with a Session object and a session namespace.
SessionInterface | $session | The user session from which the session ID is returned |
string | $namespace | The namespace under which the token is stored in the session |
Reads a stored CSRF token.
string | $tokenId | The token ID |
string | The stored token |
TokenNotFoundException | If the token ID does not exist |
Stores a CSRF token.
string | $tokenId | The token ID |
string | $token | The CSRF token |
Checks whether a token with the given token ID exists.
string | $tokenId | The token ID |
bool | Whether a token exists with the given ID |
Removes a CSRF token.
string | $tokenId | The token ID |
string|null | Returns the removed token if one existed, NULL otherwise |
Removes all CSRF tokens.
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.html