Documentation

NativeSessionTokenStorage
in package
implements ClearableTokenStorageInterface

Token storage that uses PHP's native session handling.

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
$sessionStarted  : bool

Methods

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

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 session namespace.

public __construct([string $namespace = self::SESSION_NAMESPACE ]) : mixed
Parameters
$namespace : string = self::SESSION_NAMESPACE

The namespace under which the token is stored in the session

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