class PendingPersistentLogin in Persistent Login 8
A policy preventing caching of pages with pending persistent login cookies.
Hierarchy
- class \Drupal\persistent_login\PageCache\RequestPolicy\PendingPersistentLogin implements RequestPolicyInterface
Expanded class hierarchy of PendingPersistentLogin
1 string reference to 'PendingPersistentLogin'
1 service uses PendingPersistentLogin
File
- src/
PageCache/ RequestPolicy/ PendingPersistentLogin.php, line 13
Namespace
Drupal\persistent_login\PageCache\RequestPolicyView source
class PendingPersistentLogin implements RequestPolicyInterface {
/**
* The session configuration.
*
* @var \Drupal\Core\Session\SessionConfigurationInterface
*/
protected $sessionConfiguration;
/**
* The cookie helper service.
*
* @var \Drupal\persistent_login\CookieHelperInterface
*/
protected $cookieHelper;
/**
* Instantiates a new PendingPersistentLogin object.
*
* @param \Drupal\persistent_login\CookieHelperInterface $cookie_helper
* The cookie helper service.
* @param \Drupal\Core\Session\SessionConfigurationInterface $session_configuration
* The session configuration.
*/
public function __construct(CookieHelperInterface $cookie_helper, SessionConfigurationInterface $session_configuration) {
$this->cookieHelper = $cookie_helper;
$this->sessionConfiguration = $session_configuration;
}
/**
* {@inheritdoc}
*/
public function check(Request $request) {
// Prevent the serving of cached pages for anonymous users if a persistent
// login cookie is present.
if (!$this->sessionConfiguration
->hasSession($request) && $this->cookieHelper
->hasCookie($request)) {
return static::DENY;
}
return NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PendingPersistentLogin:: |
protected | property | The cookie helper service. | |
PendingPersistentLogin:: |
protected | property | The session configuration. | |
PendingPersistentLogin:: |
public | function |
Determines whether delivery of a cached page should be attempted. Overrides RequestPolicyInterface:: |
|
PendingPersistentLogin:: |
public | function | Instantiates a new PendingPersistentLogin object. | |
RequestPolicyInterface:: |
constant | Allow delivery of cached pages. | ||
RequestPolicyInterface:: |
constant | Deny delivery of cached pages. |