class DisallowKeyAuthRequests in Key auth 8
Cache policy for pages served from key auth.
This policy disallows caching of requests that use key_auth for security reasons. Otherwise responses for authenticated requests can get into the page cache and could be delivered to unprivileged users.
Hierarchy
- class \Drupal\key_auth\PageCache\DisallowKeyAuthRequests implements RequestPolicyInterface
Expanded class hierarchy of DisallowKeyAuthRequests
1 string reference to 'DisallowKeyAuthRequests'
1 service uses DisallowKeyAuthRequests
File
- src/
PageCache/ DisallowKeyAuthRequests.php, line 16
Namespace
Drupal\key_auth\PageCacheView source
class DisallowKeyAuthRequests implements RequestPolicyInterface {
/**
* The key auth service.
*
* @var \Drupal\key_auth\KeyAuthInterface
*/
protected $keyAuth;
/**
* Constructs a key authentication page cache policy.
*
* @param \Drupal\key_auth\KeyAuthInterface $key_auth
* The key auth service..
*/
public function __construct(KeyAuthInterface $key_auth) {
$this->keyAuth = $key_auth;
}
/**
* {@inheritdoc}
*/
public function check(Request $request) {
if ($this->keyAuth
->getKey($request)) {
return self::DENY;
}
return NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DisallowKeyAuthRequests:: |
protected | property | The key auth service. | |
DisallowKeyAuthRequests:: |
public | function |
Determines whether delivery of a cached page should be attempted. Overrides RequestPolicyInterface:: |
|
DisallowKeyAuthRequests:: |
public | function | Constructs a key authentication page cache policy. | |
RequestPolicyInterface:: |
constant | Allow delivery of cached pages. | ||
RequestPolicyInterface:: |
constant | Deny delivery of cached pages. |