diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php index 85194d4..df35ce8 100644 --- a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php +++ b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php @@ -90,10 +90,12 @@ public function authenticate(Request $request) { $auth_providers = $this->getSortedProviders(); - $route = isset($defaults[RouteObjectInterface::ROUTE_OBJECT]) ? $defaults[RouteObjectInterface::ROUTE_OBJECT] : NULL; - if ($route && ($route_name = $route->getOption('_auth'))) { - $allowed_providers = array($route_name => TRUE); - $auth_providers = array_intersect_key($auth_providers, $allowed_providers); + if ($request->attributes->has(RouteObjectInterface::ROUTE_OBJECT)) { + $route = $request->attributes->get(RouteObjectInterface::ROUTE_OBJECT); + if ($route->hasOption('_auth')) { + $allowed_providers = array_flip($route->getOption('_auth')); + $auth_providers = array_intersect_key($auth_providers, $allowed_providers); + } } // Iterate the allowed providers.