interface CsrfTokenManagerInterface
Manages CSRF tokens.
CsrfToken | getToken(string $tokenId) Returns a CSRF token for the given ID. | |
CsrfToken | refreshToken(string $tokenId) Generates a new token value for the given ID. | |
string|null | removeToken(string $tokenId) Invalidates the CSRF token with the given ID, if one exists. | |
bool | isTokenValid(CsrfToken $token) Returns whether the given CSRF token is valid. |
Returns a CSRF token for the given ID.
If previously no token existed for the given ID, a new token is generated. Otherwise the existing token is returned (with the same value, not the same instance).
string | $tokenId | The token ID. You may choose an arbitrary value for the ID |
CsrfToken | The CSRF token |
Generates a new token value for the given ID.
This method will generate a new token for the given token ID, independent of whether a token value previously existed or not. It can be used to enforce once-only tokens in environments with high security needs.
string | $tokenId | The token ID. You may choose an arbitrary value for the ID |
CsrfToken | The CSRF token |
Invalidates the CSRF token with the given ID, if one exists.
string | $tokenId | The token ID |
string|null | Returns the removed token value if one existed, NULL otherwise |
Returns whether the given CSRF token is valid.
CsrfToken | $token |
bool | Returns true if the token is valid, false otherwise |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.html