SessionTokenStorage
in package
implements
ClearableTokenStorageInterface
Token storage that uses a Symfony Session object.
Tags
Interfaces, Classes, Traits and Enums
- ClearableTokenStorageInterface
- Stores CSRF tokens.
Table of Contents
- SESSION_NAMESPACE = '_csrf'
- The namespace used to store values in the session.
- $namespace : mixed
- $requestStack : mixed
- $session : mixed
- To be removed in Symfony 6.0.
- __construct() : mixed
- Initializes the storage with a RequestStack object and a session namespace.
- clear() : mixed
- Removes all CSRF tokens.
- getToken() : mixed
- {@inheritdoc}
- hasToken() : mixed
- {@inheritdoc}
- removeToken() : mixed
- {@inheritdoc}
- setToken() : mixed
- {@inheritdoc}
- getSession() : SessionInterface
Constants
SESSION_NAMESPACE
The namespace used to store values in the session.
public
mixed
SESSION_NAMESPACE
= '_csrf'
Properties
$namespace
private
mixed
$namespace
$requestStack
private
mixed
$requestStack
$session
To be removed in Symfony 6.0.
private
mixed
$session
Methods
__construct()
Initializes the storage with a RequestStack object and a session namespace.
public
__construct(RequestStack $requestStack[, string $namespace = self::SESSION_NAMESPACE ]) : mixed
Parameters
- $requestStack : RequestStack
- $namespace : string = self::SESSION_NAMESPACE
-
The namespace under which the token is stored in the requestStack
Return values
mixed —clear()
Removes all CSRF tokens.
public
clear() : mixed
Return values
mixed —getToken()
{@inheritdoc}
public
getToken(string $tokenId) : mixed
Parameters
- $tokenId : string
Return values
mixed —hasToken()
{@inheritdoc}
public
hasToken(string $tokenId) : mixed
Parameters
- $tokenId : string
Return values
mixed —removeToken()
{@inheritdoc}
public
removeToken(string $tokenId) : mixed
Parameters
- $tokenId : string
Return values
mixed —setToken()
{@inheritdoc}
public
setToken(string $tokenId, string $token) : mixed
Parameters
- $tokenId : string
- $token : string
Return values
mixed —getSession()
private
getSession() : SessionInterface