CsrfTokenManager
final class CsrfTokenManager (View source)
Maintains independently named tokens inside the default session's CSRF namespace.
Constants
| private NAMESPACE_NAME |
|
Methods
Connects token persistence to the supplied physical session without owning its lifecycle.
Returns the stable token for a name, creating it when absent or corrupt.
Compares a submitted value with the token stored for the requested name.
Replaces and returns only the token associated with the requested name.
Removes one named token while preserving every other CSRF token.
Details
__construct
__construct(SessionInterface $session)
Connects token persistence to the supplied physical session without owning its lifecycle.
token
string
token(string $name = 'default')
Returns the stable token for a name, creating it when absent or corrupt.
validate
bool
validate(string $token, string $name = 'default')
Compares a submitted value with the token stored for the requested name.
regenerate
string
regenerate(string $name = 'default')
Replaces and returns only the token associated with the requested name.
forget
void
forget(string $name = 'default')
Removes one named token while preserving every other CSRF token.