Unverified Commit 533dfa64 authored by alexpott's avatar alexpott

Issue #2986079 by benoit.borrel, alexpott, tim.plunkett, msankhala: Use...

Issue #2986079 by benoit.borrel, alexpott, tim.plunkett, msankhala: Use KernelEvent's isMasterRequest() method instead of HttpKernelInterface's constant
parent bfb51769
......@@ -10,7 +10,6 @@
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
/**
......@@ -72,7 +71,7 @@ public function __construct(AuthenticationProviderInterface $authentication_prov
* @see \Drupal\Core\Authentication\AuthenticationProviderInterface::authenticate()
*/
public function onKernelRequestAuthenticate(GetResponseEvent $event) {
if ($event->getRequestType() === HttpKernelInterface::MASTER_REQUEST) {
if ($event->isMasterRequest()) {
$request = $event->getRequest();
if ($this->authenticationProvider->applies($request)) {
$account = $this->authenticationProvider->authenticate($request);
......@@ -93,7 +92,7 @@ public function onKernelRequestAuthenticate(GetResponseEvent $event) {
* The request event.
*/
public function onKernelRequestFilterProvider(GetResponseEvent $event) {
if (isset($this->filter) && $event->getRequestType() === HttpKernelInterface::MASTER_REQUEST) {
if (isset($this->filter) && $event->isMasterRequest()) {
$request = $event->getRequest();
if ($this->authenticationProvider->applies($request) && !$this->filter->appliesToRoutedRequest($request, TRUE)) {
throw new AccessDeniedHttpException('The used authentication method is not allowed on this route.');
......@@ -112,7 +111,7 @@ public function onKernelRequestFilterProvider(GetResponseEvent $event) {
* The exception event.
*/
public function onExceptionSendChallenge(GetResponseForExceptionEvent $event) {
if (isset($this->challengeProvider) && $event->getRequestType() === HttpKernelInterface::MASTER_REQUEST) {
if (isset($this->challengeProvider) && $event->isMasterRequest()) {
$request = $event->getRequest();
$exception = $event->getException();
if ($exception instanceof AccessDeniedHttpException && !$this->authenticationProvider->applies($request) && (!isset($this->filter) || $this->filter->appliesToRoutedRequest($request, FALSE))) {
......
......@@ -6,7 +6,6 @@
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
/**
......@@ -29,7 +28,7 @@ public function onKernelException(GetResponseForExceptionEvent $event) {
*/
public function onKernelResponse(FilterResponseEvent $event) {
$response = $event->getResponse();
if ($response instanceof EnforcedResponse && $event->getRequestType() === HttpKernelInterface::MASTER_REQUEST) {
if ($response instanceof EnforcedResponse && $event->isMasterRequest()) {
$event->setResponse($response->getResponse());
}
}
......
......@@ -4,7 +4,6 @@
use Drupal\Core\Path\AliasManagerInterface;
use Drupal\Core\Path\CurrentPathStack;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
......@@ -52,7 +51,7 @@ public function __construct(AliasManagerInterface $alias_manager, CurrentPathSta
*/
public function onKernelController(FilterControllerEvent $event) {
// Set the cache key on the alias manager cache decorator.
if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
if ($event->isMasterRequest()) {
$this->aliasManager->setCacheKey(rtrim($this->currentPath->getPath($event->getRequest()), '/'));
}
}
......
......@@ -7,7 +7,6 @@
use Drupal\Core\StringTranslation\Translator\TranslatorInterface;
use Drupal\language\ConfigurableLanguageManagerInterface;
use Drupal\language\LanguageNegotiatorInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
......@@ -71,7 +70,7 @@ public function __construct(ConfigurableLanguageManagerInterface $language_manag
* The Event to process.
*/
public function onKernelRequestLanguage(GetResponseEvent $event) {
if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
if ($event->isMasterRequest()) {
$this->setLanguageOverrides();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment