You are here

class Auth in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/locale/tests/modules/early_translation_test/src/Auth.php \Drupal\early_translation_test\Auth

Test authentication provider.

Hierarchy

Expanded class hierarchy of Auth

1 string reference to 'Auth'
early_translation_test.services.yml in core/modules/locale/tests/modules/early_translation_test/early_translation_test.services.yml
core/modules/locale/tests/modules/early_translation_test/early_translation_test.services.yml
1 service uses Auth
early_translation_test.authentication.early_translation_test in core/modules/locale/tests/modules/early_translation_test/early_translation_test.services.yml
Drupal\early_translation_test\Auth

File

core/modules/locale/tests/modules/early_translation_test/src/Auth.php, line 12

Namespace

Drupal\early_translation_test
View source
class Auth implements AuthenticationProviderInterface {

  /**
   * The user storage.
   *
   * @var \Drupal\user\UserStorageInterface
   */
  protected $userStorage;

  /**
   * Constructs an authentication provider object.
   *
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   */
  public function __construct(EntityTypeManagerInterface $entity_type_manager) {

    // Authentication providers are called early during in the bootstrap.
    // Getting the user storage used to result in a circular reference since
    // translation involves a call to \Drupal\locale\LocaleLookup that tries to
    // get the user roles.
    // @see https://www.drupal.org/node/2241461
    $this->userStorage = $entity_type_manager
      ->getStorage('user');
  }

  /**
   * {@inheritdoc}
   */
  public function applies(Request $request) {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function authenticate(Request $request) {
    return NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Auth::$userStorage protected property The user storage.
Auth::applies public function Checks whether suitable authentication credentials are on the request. Overrides AuthenticationProviderInterface::applies
Auth::authenticate public function Authenticates the user. Overrides AuthenticationProviderInterface::authenticate
Auth::__construct public function Constructs an authentication provider object.