class MetadataBag in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/http-foundation/Session/Storage/MetadataBag.php \Symfony\Component\HttpFoundation\Session\Storage\MetadataBag
- 8 core/lib/Drupal/Core/Session/MetadataBag.php \Drupal\Core\Session\MetadataBag
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Session/MetadataBag.php \Drupal\Core\Session\MetadataBag
Provides a container for application specific session metadata.
Hierarchy
- class \Symfony\Component\HttpFoundation\Session\Storage\MetadataBag implements SessionBagInterface
- class \Drupal\Core\Session\MetadataBag
Expanded class hierarchy of MetadataBag
1 file declares its use of MetadataBag
- CsrfTokenGenerator.php in core/
lib/ Drupal/ Core/ Access/ CsrfTokenGenerator.php - Contains \Drupal\Core\Access\CsrfTokenGenerator.
1 string reference to 'MetadataBag'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses MetadataBag
File
- core/
lib/ Drupal/ Core/ Session/ MetadataBag.php, line 16 - Contains \Drupal\Core\Session\MetadataBag.
Namespace
Drupal\Core\SessionView source
class MetadataBag extends SymfonyMetadataBag {
/**
* The key used to store the CSRF token seed in the session.
*/
const CSRF_TOKEN_SEED = 's';
/**
* Constructs a new metadata bag instance.
*
* @param \Drupal\Core\Site\Settings $settings
* The settings instance.
*/
public function __construct(Settings $settings) {
$update_threshold = $settings
->get('session_write_interval', 180);
parent::__construct('_sf2_meta', $update_threshold);
}
/**
* Set the CSRF token seed.
*
* @param string $csrf_token_seed
* The per-session CSRF token seed.
*/
public function setCsrfTokenSeed($csrf_token_seed) {
$this->meta[static::CSRF_TOKEN_SEED] = $csrf_token_seed;
}
/**
* Get the CSRF token seed.
*
* @return string|null
* The per-session CSRF token seed or null when no value is set.
*/
public function getCsrfTokenSeed() {
if (isset($this->meta[static::CSRF_TOKEN_SEED])) {
return $this->meta[static::CSRF_TOKEN_SEED];
}
}
/**
* Clear the CSRF token seed.
*/
public function clearCsrfTokenSeed() {
unset($this->meta[static::CSRF_TOKEN_SEED]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MetadataBag:: |
private | property | Unix timestamp. | |
MetadataBag:: |
protected | property | ||
MetadataBag:: |
private | property | ||
MetadataBag:: |
private | property | ||
MetadataBag:: |
private | property | ||
MetadataBag:: |
public | function |
Clears out data from bag. Overrides SessionBagInterface:: |
|
MetadataBag:: |
public | function | Clear the CSRF token seed. | |
MetadataBag:: |
constant | |||
MetadataBag:: |
constant | The key used to store the CSRF token seed in the session. | ||
MetadataBag:: |
public | function | Gets the created timestamp metadata. | |
MetadataBag:: |
public | function | Get the CSRF token seed. | |
MetadataBag:: |
public | function | Gets the last used metadata. | |
MetadataBag:: |
public | function | Gets the lifetime that the session cookie was set with. | |
MetadataBag:: |
public | function |
Gets this bag's name. Overrides SessionBagInterface:: |
|
MetadataBag:: |
public | function |
Gets the storage key for this bag. Overrides SessionBagInterface:: |
|
MetadataBag:: |
public | function |
Initializes the Bag. Overrides SessionBagInterface:: |
|
MetadataBag:: |
constant | |||
MetadataBag:: |
public | function | Set the CSRF token seed. | |
MetadataBag:: |
public | function | Sets name. | |
MetadataBag:: |
private | function | ||
MetadataBag:: |
public | function | Stamps a new session's metadata. | |
MetadataBag:: |
constant | |||
MetadataBag:: |
public | function |
Constructs a new metadata bag instance. Overrides MetadataBag:: |