Issue #2986079 by benoit.borrel, alexpott, tim.plunkett, msankhala: Use KernelEvent's isMasterRequest() method instead of HttpKernelInterface's constant
parent
bfb517693e
commit
533dfa6479
|
@ -10,7 +10,6 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|||
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 @@ class AuthenticationSubscriber implements EventSubscriberInterface {
|
|||
* @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 @@ class AuthenticationSubscriber implements EventSubscriberInterface {
|
|||
* 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 @@ class AuthenticationSubscriber implements EventSubscriberInterface {
|
|||
* 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 Drupal\Core\Form\EnforcedResponse;
|
|||
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 @@ class EnforcedFormResponseSubscriber implements EventSubscriberInterface {
|
|||
*/
|
||||
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 @@ namespace Drupal\Core\EventSubscriber;
|
|||
|
||||
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 @@ class PathSubscriber implements EventSubscriberInterface {
|
|||
*/
|
||||
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\Session\AccountInterface;
|
|||
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 @@ class LanguageRequestSubscriber implements EventSubscriberInterface {
|
|||
* The Event to process.
|
||||
*/
|
||||
public function onKernelRequestLanguage(GetResponseEvent $event) {
|
||||
if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
|
||||
if ($event->isMasterRequest()) {
|
||||
$this->setLanguageOverrides();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue