Class Yiisoft\Csrf\Synchronizer\Storage\SessionCsrfTokenStorage
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
Persists a token between requests in a user session.
Public Methods
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| KEY | '_csrf' | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $session | \ |
|
| $key | string |
Session key used to store data. Default is "_csrf". |
public function __construct(SessionInterface $session, string $key = self::KEY)
{
$this->key = $key;
$this->session = $session;
}
| public ?string get ( ) |
public function get(): ?string
{
$value = $this->session->get($this->key);
return is_string($value) ? $value : null;
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.