Skip to content
Snippets Groups Projects
Verified Commit fee6f4e0 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3456738 by cmlara, Anybody, andrewbelcher, Berdir, catch: BC break in...

Issue #3456738 by cmlara, Anybody, andrewbelcher, Berdir, catch: BC break in login auth changes from #3444978

(cherry picked from commit e015f808)
parent ba361554
No related branches found
No related tags found
11 merge requests!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8949Backport .gitlabci.yml changes.,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #220559 passed with warnings
Pipeline: drupal

#220578

    Pipeline: drupal

    #220568

      ......@@ -201,7 +201,7 @@ public function login(Request $request) {
      $authenticated = $this->userAuth->authenticateAccount($account, $credentials['pass']) ? $account->id() : FALSE;
      }
      else {
      $authenticated = $this->userAuth->authenticateAccount($credentials['name'], $credentials['pass']);
      $authenticated = $this->userAuth->authenticate($credentials['name'], $credentials['pass']);
      }
      if ($authenticated) {
      $this->userFloodControl->clear('user.http_login', $this->getLoginFloodIdentifier($request, $credentials['name']));
      ......
      ......@@ -246,6 +246,13 @@ public function validateAuthentication(array &$form, FormStateInterface $form_st
      if ($this->userAuth instanceof UserAuthenticationInterface) {
      $form_state->set('uid', $this->userAuth->authenticateAccount($account, $password) ? $account->id() : FALSE);
      }
      // The userAuth object is decorated by an object that that has not
      // been upgraded to the new UserAuthenticationInterface. Fallback
      // to the authenticate() method.
      else {
      $uid = $this->userAuth->authenticate($form_state->getValue('name'), $password);
      $form_state->set('uid', $uid);
      }
      }
      elseif (!$this->userAuth instanceof UserAuthenticationInterface) {
      $uid = $this->userAuth->authenticate($form_state->getValue('name'), $password);
      ......
      <?php
      namespace Drupal\user_auth_decorator_test;
      use Drupal\user\UserAuthInterface;
      /**
      * Helper to validate UserAuthInterface BC layers are functional.
      */
      class UserAuthDecorator implements UserAuthInterface {
      /**
      * Constructs a UserAuthDecorator object.
      *
      * @param \Drupal\user\UserAuthInterface $inner
      * The inner User.Auth service.
      */
      public function __construct(protected UserAuthInterface $inner) {
      }
      /**
      * {@inheritdoc}
      */
      public function authenticate($username, #[\SensitiveParameter] $password) {
      return $this->inner->authenticate($username, $password);
      }
      }
      name: 'User Auth Service decorated only with UserAuthInterface'
      type: module
      description: 'Support module for user authentication testing.'
      package: Testing
      version: VERSION
      services:
      user_auth_decorator.user.auth:
      class: \Drupal\user_auth_decorator_test\UserAuthDecorator
      decorates: user.auth
      arguments:
      - '@user_auth_decorator.user.auth.inner'
      <?php
      declare(strict_types=1);
      namespace Drupal\Tests\user\Functional\Rest;
      use Drupal\user_auth_decorator_test\UserAuthDecorator;
      /**
      * Run UserJsonBasicAuthTest with a user.auth decorator.
      *
      * @group rest
      * @group #slow
      */
      class UserJsonBasicAuthDecoratedTest extends UserJsonBasicAuthTest {
      /**
      * Modules to install.
      *
      * @var array
      */
      protected static $modules = ['user_auth_decorator_test'];
      /**
      * Test that the UserAuthDecorator is providing user.auth.
      */
      public function testServiceDecorated(): void {
      $service = \Drupal::service('user.auth');
      $this->assertInstanceOf(UserAuthDecorator::class, $service);
      }
      }
      <?php
      declare(strict_types=1);
      namespace Drupal\Tests\user\Functional;
      use Drupal\user_auth_decorator_test\UserAuthDecorator;
      /**
      * Ensure that login works as expected with a decorator.
      *
      * The decorator does not implement UserAuthenticationInterface.
      *
      * @group user
      */
      class UserLoginDecoratedTest extends UserLoginTest {
      /**
      * Modules to install.
      *
      * @var array
      */
      protected static $modules = ['user_auth_decorator_test'];
      /**
      * Test that the UserAuthDecorator is providing user.auth.
      */
      public function testServiceDecorated(): void {
      $service = \Drupal::service('user.auth');
      $this->assertInstanceOf(UserAuthDecorator::class, $service);
      }
      }
      <?php
      declare(strict_types=1);
      namespace Drupal\Tests\user\Functional;
      use Drupal\user_auth_decorator_test\UserAuthDecorator;
      /**
      * Tests login and password reset via direct HTTP with a user.auth decorator.
      *
      * The decorator does not implement UserAuthenticationInterface.
      *
      * @group user
      */
      class UserLoginHttpDecoratedTest extends UserLoginHttpTest {
      /**
      * Modules to install.
      *
      * @var array
      */
      protected static $modules = ['user_auth_decorator_test'];
      /**
      * Test that the UserAuthDecorator is providing user.auth.
      */
      public function testServiceDecorated(): void {
      $service = \Drupal::service('user.auth');
      $this->assertInstanceOf(UserAuthDecorator::class, $service);
      }
      }
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Please register or to comment