class DenyCas in CAS 8
Same name and namespace in other branches
- 2.x src/PageCache/DenyCas.php \Drupal\cas\PageCache\DenyCas
Ensures pages configured with gateway authentication are not cached.
The logic we use to determine if a user should be redirected to gateway auth is currently not compatible with page caching.
Hierarchy
- class \Drupal\cas\PageCache\DenyCas implements ResponsePolicyInterface
Expanded class hierarchy of DenyCas
1 string reference to 'DenyCas'
1 service uses DenyCas
File
- src/
PageCache/ DenyCas.php, line 18
Namespace
Drupal\cas\PageCacheView source
class DenyCas implements ResponsePolicyInterface {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Condition manager.
*
* @var \Drupal\Core\Executable\ExecutableManagerInterface
*/
protected $conditionManager;
/**
* Constructs a response policy for disabling cache on specific CAS paths.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The current route match.
* @param \Drupal\Core\Executable\ExecutableManagerInterface $condition_manager
* The condition manager.
*/
public function __construct(ConfigFactoryInterface $config_factory, ExecutableManagerInterface $condition_manager) {
$this->configFactory = $config_factory;
$this->conditionManager = $condition_manager;
}
/**
* {@inheritdoc}
*/
public function check(Response $response, Request $request) {
$config = $this->configFactory
->get('cas.settings');
if ($config
->get('gateway.check_frequency') !== CasHelper::CHECK_NEVER) {
// User can indicate specific paths to enable (or disable) gateway mode.
$condition = $this->conditionManager
->createInstance('request_path');
$condition
->setConfiguration($config
->get('gateway.paths'));
if ($this->conditionManager
->execute($condition)) {
return static::DENY;
}
}
return NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DenyCas:: |
protected | property | Condition manager. | |
DenyCas:: |
protected | property | The config factory. | |
DenyCas:: |
public | function |
Determines whether it is save to store a page in the cache. Overrides ResponsePolicyInterface:: |
|
DenyCas:: |
public | function | Constructs a response policy for disabling cache on specific CAS paths. | |
ResponsePolicyInterface:: |
constant | Deny storage of a page in the cache. |