W3cubDocs

/Symfony 4.1

ClearableTokenStorageInterface

interface ClearableTokenStorageInterface implements TokenStorageInterface

Methods

string getToken(string $tokenId)

Reads a stored CSRF token.

from TokenStorageInterface
setToken(string $tokenId, string $token)

Stores a CSRF token.

from TokenStorageInterface
string|null removeToken(string $tokenId)

Removes a CSRF token.

from TokenStorageInterface
bool hasToken(string $tokenId)

Checks whether a token with the given token ID exists.

from TokenStorageInterface
clear()

Removes all CSRF tokens.

Details

string getToken(string $tokenId)

Reads a stored CSRF token.

Parameters

string $tokenId The token ID

Return Value

string The stored token

Exceptions

TokenNotFoundException If the token ID does not exist

setToken(string $tokenId, string $token)

Stores a CSRF token.

Parameters

string $tokenId The token ID
string $token The CSRF token

string|null removeToken(string $tokenId)

Removes a CSRF token.

Parameters

string $tokenId The token ID

Return Value

string|null Returns the removed token if one existed, NULL otherwise

bool hasToken(string $tokenId)

Checks whether a token with the given token ID exists.

Parameters

string $tokenId The token ID

Return Value

bool Whether a token exists with the given ID

clear()

Removes all CSRF tokens.