Class Yiisoft\Csrf\Synchronizer\Storage\SessionCsrfTokenStorage
| Inheritance | Yiisoft\Csrf\Synchronizer\Storage\SessionCsrfTokenStorage |
|---|---|
| Implements | Yiisoft\Csrf\Synchronizer\Storage\CsrfTokenStorageInterface |
Persists a token between requests in a user session.
Public Methods
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| KEY | '_csrf' | Yiisoft\Csrf\Synchronizer\Storage\SessionCsrfTokenStorage |
Method Details
| public mixed __construct ( \Yiisoft\Session\SessionInterface $session, string $key = self::KEY ) | ||
| $session | \Yiisoft\Session\SessionInterface | |
| $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|null get ( ) |
public function get(): ?string
{
$value = $this->session->get($this->key);
return is_string($value) ? $value : null;
}
Signup or Login in order to comment.