core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php | 2 +- .../src/Functional/EntityResource/EntityResourceTestBase.php | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php index d6b72d7..5377fbf 100644 --- a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php @@ -129,7 +129,7 @@ public function onExceptionSendChallenge(GetResponseForExceptionEvent $event) { * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event */ public function onExceptionAccessDenied(GetResponseForExceptionEvent $event) { - if (isset($this->filter) && $event->getRequestType() === HttpKernelInterface::MASTER_REQUEST) { + if (isset($this->filter) && $event->isMasterRequest()) { $request = $event->getRequest(); $exception = $event->getException(); if ($exception instanceof AccessDeniedHttpException && $this->authenticationProvider->applies($request) && !$this->filter->appliesToRoutedRequest($request, TRUE)) { diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index ab13a30..e7a54f9 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -457,13 +457,7 @@ public function testGet() { $expected_cacheability = $this->getExpectedUnauthorizedAccessCacheability() // @see \Drupal\Core\EventSubscriber\AnonymousUserResponseSubscriber::onRespond() ->addCacheTags(['config:user.role.anonymous']); - $entity_type = $this->entity->getEntityType(); - // When the canonical URL *is* the same as the edit form's, the canonical - // is just an alias, and hence an 'update' entity access is checked, not - // 'view'. Hence only add entity access cacheability conditionally. - if ($this->entity->hasLinkTemplate('edit-form') && $entity_type->getLinkTemplate('canonical') !== $entity_type->getLinkTemplate('edit-form')) { - $expected_cacheability->addCacheableDependency($this->getExpectedUnauthorizedEntityAccessCacheability(FALSE)); - } + $expected_cacheability->addCacheableDependency($this->getExpectedUnauthorizedEntityAccessCacheability(FALSE)); $this->assertResourceErrorResponse(403, $this->getExpectedUnauthorizedAccessMessage('GET'), $response, $expected_cacheability->getCacheTags(), $expected_cacheability->getCacheContexts(), 'MISS', FALSE); } else {