diff -u b/core/modules/rest/rest.install b/core/modules/rest/rest.install --- b/core/modules/rest/rest.install +++ b/core/modules/rest/rest.install @@ -92,19 +92,30 @@ } /** + * @} End of "defgroup updates-8.1.x-to-8.2.x". + */ + +/** + * @defgroup updates-8.3.x-to-8.4.x Updates from 8.3.x to 8.4.x + * @{ + * Update functions from 8.3.x to 8.4.x. + */ + +/** * Ensure the right REST authentication method is used. * * This fixes the bug in https://www.drupal.org/node/2825204. */ -function rest_update_8204() { +function rest_update_8401() { $config_factory = \Drupal::configFactory(); - $process_auth = function ($auth_option) { - switch ($auth_option) { - case 'user': - return 'cookie'; + $auth_providers = \Drupal::service('authentication_collector')->getSortedProviders(); + $process_auth = function ($auth_option) use ($auth_providers) { + foreach ($auth_providers as $provider_id => $provider_data) { + // The provider belongs to the module that declares it as a service. + if (strtok($provider_data->_serviceId, '.') === $auth_option) { + return $provider_id; + } } - - return $auth_option; }; foreach ($config_factory->listAll('views.view.') as $view_config_name) { @@ -127,3 +138,3 @@ /** - * @} End of "defgroup updates-8.1.x-to-8.2.x". + * @} End of "defgroup updates-8.3.x-to-8.4.x". */