diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php index 9e05dd1..2d0b94a 100644 --- a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php +++ b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php @@ -17,12 +17,10 @@ * * On each request, let all authentication providers try to authenticate the * user. The providers are iterated according to their priority and the first - * provider detecting credentials for its method will become the triggered - * provider. No further provider will get triggered. + * provider detecting credentials for its method wins. No further provider will + * get triggered. * - * If no provider was triggered the lowest-priority provider is assumed to - * be responsible. If no provider set an active user then the user is set to - * anonymous. + * If no provider set an active user then the user is set to anonymous. */ class AuthenticationManager implements AuthenticationProviderInterface { @@ -48,13 +46,6 @@ class AuthenticationManager implements AuthenticationProviderInterface { protected $sortedProviders; /** - * Id of the provider that authenticated the user. - * - * @var string - */ - protected $triggeredProviderId = ''; - - /** * Adds a provider to the array of registered providers. * * @param \Drupal\Core\Authentication\AuthenticationProviderInterface $provider @@ -94,7 +85,6 @@ public function authenticate(Request $request) { if ($provider->applies($request)) { // Try to authenticate with this provider, skipping all others. $account = $provider->authenticate($request); - $this->triggeredProviderId = $provider_id; break; } } @@ -104,12 +94,6 @@ public function authenticate(Request $request) { $account = new AnonymousUserSession(); } - // No provider was fired, so assume the one with the least priority - // should have. - if (!$this->triggeredProviderId) { - $this->triggeredProviderId = $this->defaultProviderId(); - } - // The global $user object is included for backward compatibility only and // should be considered deprecated. // @todo Remove this line once global $user is no longer used. @@ -124,7 +108,7 @@ public function authenticate(Request $request) { * @return array * An array of authentication provider objects. */ - public function getSortedProviders() { + protected function getSortedProviders() { if (!isset($this->sortedProviders)) { // Sort the builders according to priority. krsort($this->providerOrders); @@ -138,24 +122,6 @@ public function getSortedProviders() { } /** - * Cleans up the authentication. - * - * Allow the triggered provider to clean up before the response is sent, e.g. - * trigger a session commit. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * The request object. - * - * @see \Drupal\Core\Authentication\Provider\Cookie::cleanup() - */ - public function cleanup(Request $request) { - if (empty($this->providers[$this->triggeredProviderId])) { - return; - } - $this->providers[$this->triggeredProviderId]->cleanup($request); - } - - /** * {@inheritdoc} */ public function handleException(GetResponseForExceptionEvent $event) { diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationProviderInterface.php b/core/lib/Drupal/Core/Authentication/AuthenticationProviderInterface.php index bc8e10c..03966d6 100644 --- a/core/lib/Drupal/Core/Authentication/AuthenticationProviderInterface.php +++ b/core/lib/Drupal/Core/Authentication/AuthenticationProviderInterface.php @@ -39,18 +39,6 @@ public function applies(Request $request); public function authenticate(Request $request); /** - * Performs cleanup tasks at the end of a request. - * - * Allow the authentication provider to clean up before the response is sent. - * This is uses for instance in \Drupal\Core\Authentication\Provider\Cookie to - * ensure the session gets committed. - * - * @param Request $request - * The request object. - */ - public function cleanup(Request $request); - - /** * Handles an exception. * * In case exception has happened we allow authentication providers react. diff --git a/core/lib/Drupal/Core/Authentication/Provider/Cookie.php b/core/lib/Drupal/Core/Authentication/Provider/Cookie.php index d7c8636..b3a831f 100644 --- a/core/lib/Drupal/Core/Authentication/Provider/Cookie.php +++ b/core/lib/Drupal/Core/Authentication/Provider/Cookie.php @@ -59,12 +59,6 @@ public function authenticate(Request $request) { /** * {@inheritdoc} */ - public function cleanup(Request $request) { - } - - /** - * {@inheritdoc} - */ public function handleException(GetResponseForExceptionEvent $event) { return FALSE; } diff --git a/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php b/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php index 47d2a35..330e626 100644 --- a/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php +++ b/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php @@ -140,11 +140,6 @@ public function authenticate(Request $request) { /** * {@inheritdoc} */ - public function cleanup(Request $request) {} - - /** - * {@inheritdoc} - */ public function handleException(GetResponseForExceptionEvent $event) { $exception = $event->getException(); $request = $event->getRequest(); diff --git a/core/modules/locale/tests/modules/early_translation_test/src/Auth.php b/core/modules/locale/tests/modules/early_translation_test/src/Auth.php index afb5ea1..5388d5d 100644 --- a/core/modules/locale/tests/modules/early_translation_test/src/Auth.php +++ b/core/modules/locale/tests/modules/early_translation_test/src/Auth.php @@ -56,11 +56,6 @@ public function authenticate(Request $request) { /** * {@inheritdoc} */ - public function cleanup(Request $request) {} - - /** - * {@inheritdoc} - */ public function handleException(GetResponseForExceptionEvent $event) { return FALSE; }