Documentation

SessionTokenStorage
in package
implements ClearableTokenStorageInterface

Token storage that uses a Symfony Session object.

Tags
author

Bernhard Schussek bschussek@gmail.com

Table of Contents

Interfaces

ClearableTokenStorageInterface
Stores CSRF tokens.

Constants

SESSION_NAMESPACE  = '_csrf'
The namespace used to store values in the session.

Properties

$namespace  : string
$requestStack  : mixed

Methods

__construct()  : mixed
Initializes the storage with a RequestStack object and a session namespace.
clear()  : mixed
Removes all CSRF tokens.
getToken()  : string
{@inheritdoc}
hasToken()  : bool
{@inheritdoc}
removeToken()  : string|null
{@inheritdoc}
setToken()  : mixed
{@inheritdoc}
getSession()  : SessionInterface

Constants

SESSION_NAMESPACE

The namespace used to store values in the session.

public mixed SESSION_NAMESPACE = '_csrf'

Properties

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

getToken()

{@inheritdoc}

public getToken(string $tokenId) : string
Parameters
$tokenId : string
Return values
string

hasToken()

{@inheritdoc}

public hasToken(string $tokenId) : bool
Parameters
$tokenId : string
Return values
bool

removeToken()

{@inheritdoc}

public removeToken(string $tokenId) : string|null
Parameters
$tokenId : string
Return values
string|null

setToken()

{@inheritdoc}

public setToken(string $tokenId, string $token) : mixed
Parameters
$tokenId : string
$token : string

        
On this page

Search results