diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php index 17498ba..d95873d 100644 --- a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php +++ b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php @@ -52,7 +52,12 @@ public function applies(Request $request) { public function authenticate(Request $request) { $provider_id = $this->getProvider($request); $provider = $this->authCollector->getProvider($provider_id); - return $provider->authenticate($request); + + if ($provider) { + return $provider->authenticate($request); + } + + return NULL; } /** @@ -82,7 +87,8 @@ public function appliesToRoutedRequest(Request $request, $authenticated) { public function challengeException(Request $request, \Exception $previous) { $provider_id = $this->getChallenger($request); - if ($provider_id && ($provider = $this->authCollector->getProvider($provider_id))) { + if ($provider_id) { + $provider = $this->authCollector->getProvider($provider_id); return $provider->challengeException($request, $previous); } } diff --git a/core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php b/core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php index bfc8d51..609f4f3 100644 --- a/core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php +++ b/core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php @@ -19,7 +19,7 @@ class AuthenticationCollectorTest extends UnitTestCase { /** - * Add test providers to the AuthenticationCollector and test various methods. + * Tests adding, getting, and order of priorities. * * @covers ::addProvider * @covers ::getSortedProviders @@ -67,7 +67,7 @@ class TestAuthenticationProvider implements AuthenticationProviderInterface { /** * The provider id. * - * @var $provider_id + * @var string */ public $providerId;