diff --git a/core/core.services.yml b/core/core.services.yml index a5de422..5234029 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -584,7 +584,7 @@ services: arguments: ['@url_generator', '@module_handler'] router: class: Drupal\Core\Routing\AccessAwareRouter - arguments: ['@router.no_access_checks', '@access_manager', '@authentication', '@current_user'] + arguments: ['@router.no_access_checks', '@access_manager', '@current_user'] router.dynamic: class: Symfony\Cmf\Component\Routing\DynamicRouter arguments: ['@router.request_context', '@router.matcher', '@url_generator'] diff --git a/core/lib/Drupal/Core/Routing/AccessAwareRouter.php b/core/lib/Drupal/Core/Routing/AccessAwareRouter.php index 33feaaa..b5491ff 100644 --- a/core/lib/Drupal/Core/Routing/AccessAwareRouter.php +++ b/core/lib/Drupal/Core/Routing/AccessAwareRouter.php @@ -8,7 +8,6 @@ namespace Drupal\Core\Routing; use Drupal\Core\Access\AccessManagerInterface; -use Drupal\Core\Authentication\AuthenticationProviderInterface; use Drupal\Core\Session\AccountProxyInterface; use Symfony\Cmf\Component\Routing\ChainRouter; use Symfony\Component\HttpFoundation\Request; @@ -35,13 +34,6 @@ class AccessAwareRouter implements AccessAwareRouterInterface { protected $accessManager; /** - * Authentication provider. - * - * @var \Drupal\Core\Authentication\AuthenticationProviderInterface - */ - protected $authenticationProvider; - - /** * The account proxy to authenticate and to use in access checks. * * @var \Drupal\Core\Session\AccountProxyInterface; @@ -55,15 +47,12 @@ class AccessAwareRouter implements AccessAwareRouterInterface { * The chain router doing the actual routing. * @param \Drupal\Core\Access\AccessManagerInterface $access_manager * The access manager. - * @param \Drupal\Core\Authentication\AuthenticationProviderInterface $authentication_provider - * The authentication provider. * @param \Drupal\Core\Session\AccountProxyInterface $account_proxy - * The account proxy to authenticate and to use in access checks. + * The account proxy to use in access checks. */ - public function __construct(ChainRouter $chain_router, AccessManagerInterface $access_manager, AuthenticationProviderInterface $authentication_provider, AccountProxyInterface $account_proxy) { + public function __construct(ChainRouter $chain_router, AccessManagerInterface $access_manager, AccountProxyInterface $account_proxy) { $this->chainRouter = $chain_router; $this->accessManager = $access_manager; - $this->authenticationProvider = $authentication_provider; $this->accountProxy = $account_proxy; } @@ -97,22 +86,8 @@ public function getContext() { * Thrown when access checking failed. */ public function matchRequest(Request $request) { - try { - $parameters = $this->chainRouter->matchRequest($request); - $request->attributes->add($parameters); - } - catch (\Exception $e) { - try { - $this->accountProxy->setAccount($this->authenticationProvider->authenticate($request)); - } - catch (\Exception $e) { - // Ignore exception thrown while trying to authenticate inside the - // enclosing catch clause. - } - - throw $e; - } - + $parameters = $this->chainRouter->matchRequest($request); + $request->attributes->add($parameters); $this->checkAccess($request); // We can not return $parameters because the access check can change the // request attributes.