diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php index bb80c44..295c904 100644 --- a/core/lib/Drupal/Core/Authentication/AuthenticationManager.php +++ b/core/lib/Drupal/Core/Authentication/AuthenticationManager.php @@ -67,24 +67,21 @@ class AuthenticationManager implements AuthenticationProviderInterface, Authenti /** * {@inheritdoc} */ - public function addProvider(AuthenticationProviderInterface $provider, $id, $priority = 0, $global = FALSE) { - // Remove the 'authentication.' prefix from the provider ID. - $id = substr($id, 15); - - $this->providers[$id] = $provider; - $this->providerOrders[$priority][$id] = $provider; + public function addProvider(AuthenticationProviderInterface $provider, $priority = 0, $provider_id, $global = FALSE) { + $this->providers[$provider_id] = $provider; + $this->providerOrders[$priority][$provider_id] = $provider; // Force the builders to be re-sorted. $this->sortedProviders = NULL; if ($provider instanceof AuthenticationProviderFilterInterface) { - $this->filters[$id] = $provider; + $this->filters[$provider_id] = $provider; } if ($provider instanceof AuthenticationProviderChallengeInterface) { - $this->challengers[$id] = $provider; + $this->challengers[$provider_id] = $provider; } if ($global) { - $this->globalProviders[$id] = TRUE; + $this->globalProviders[$provider_id] = TRUE; } } diff --git a/core/lib/Drupal/Core/Authentication/AuthenticationManagerInterface.php b/core/lib/Drupal/Core/Authentication/AuthenticationManagerInterface.php index 62785ac..032e840 100644 --- a/core/lib/Drupal/Core/Authentication/AuthenticationManagerInterface.php +++ b/core/lib/Drupal/Core/Authentication/AuthenticationManagerInterface.php @@ -17,13 +17,13 @@ * * @param \Drupal\Core\Authentication\AuthenticationProviderInterface $provider * The provider object. - * @param string $id + * @param string $provider_id * Identifier of the provider. * @param int $priority * The providers priority. * @param bool $global * TRUE if the provider is to be applied globally on all routes. */ - public function addProvider(AuthenticationProviderInterface $provider, $id, $priority = 0, $global = FALSE); + public function addProvider(AuthenticationProviderInterface $provider, $priority = 0, $provider_id, $global = FALSE); } diff --git a/core/modules/basic_auth/basic_auth.services.yml b/core/modules/basic_auth/basic_auth.services.yml index b0473e8..be85ccc 100644 --- a/core/modules/basic_auth/basic_auth.services.yml +++ b/core/modules/basic_auth/basic_auth.services.yml @@ -1,9 +1,9 @@ services: - authentication.basic_auth: + basic_auth.authentication.basic_auth: class: Drupal\basic_auth\Authentication\Provider\BasicAuth arguments: ['@config.factory', '@user.auth', '@flood', '@entity.manager'] tags: - - { name: authentication_provider, priority: 100 } + - { name: authentication_provider, provider_id: 'basic_auth', priority: 100 } basic_auth.page_cache_request_policy.disallow_basic_auth_requests: class: Drupal\basic_auth\PageCache\DisallowBasicAuthRequests public: false diff --git a/core/modules/user/user.services.yml b/core/modules/user/user.services.yml index e93e2ef..be4e679 100644 --- a/core/modules/user/user.services.yml +++ b/core/modules/user/user.services.yml @@ -15,11 +15,11 @@ services: class: Drupal\user\Access\LoginStatusCheck tags: - { name: access_check, applies_to: _user_is_logged_in } - authentication.cookie: + user.authentication.cookie: class: Drupal\user\Authentication\Provider\Cookie arguments: ['@session_configuration', '@database'] tags: - - { name: authentication_provider, priority: 0, global: TRUE } + - { name: authentication_provider, provider_id: 'cookie', priority: 0, global: TRUE } user.data: class: Drupal\user\UserData arguments: ['@database'] diff --git a/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php b/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php index a8e402d..eb40ef7 100644 --- a/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php @@ -30,7 +30,7 @@ class AuthenticationManagerTest extends UnitTestCase { public function testDefaultFilter($applies, $has_route, $auth_option, $provider_id, $global) { $authentication_manager = new AuthenticationManager(); $auth_provider = $this->getMock('Drupal\Core\Authentication\AuthenticationProviderInterface'); - $authentication_manager->addProvider($auth_provider, 'authentication.' . $provider_id, 0, $global); + $authentication_manager->addProvider($auth_provider, 0, $provider_id, $global); $request = new Request(); if ($has_route) { @@ -50,7 +50,7 @@ public function testDefaultFilter($applies, $has_route, $auth_option, $provider_ public function testApplyFilterWithFilterprovider() { $authentication_manager = new AuthenticationManager(); $auth_provider = $this->getMock('Drupal\Tests\Core\Authentication\TestAuthenticationProviderInterface'); - $authentication_manager->addProvider($auth_provider, 'authentication.filtered'); + $authentication_manager->addProvider($auth_provider, 0, 'filtered'); $auth_provider->expects($this->once()) ->method('appliesToRoutedRequest')