public function SecuresiteSubscriber::onResponse in Secure Site 8
Add headers to response based on authentication by securesite
Parameters
\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event: The event to process.
File
- src/
EventSubscriber/ SecuresiteSubscriber.php, line 79 - Contains Drupal\securesite\EventSubscriber\SecuresiteSubscriber.
Class
- SecuresiteSubscriber
- Subscribes to the kernel request event to check whether authentication is required
Namespace
Drupal\securesite\EventSubscriberCode
public function onResponse(FilterResponseEvent $event) {
$request = $event
->getRequest();
$response = $event
->getResponse();
foreach ($request->securesiteHeaders as $name => $value) {
if ($name === 'Status') {
$response
->setStatusCode($value);
if ($value == '401' || $value == '403') {
$response
->setContent('');
}
}
else {
$response->headers
->set($name, $value);
}
}
}