interface UserAuthenticationInterface

Same name and namespace in other branches
  1. 11.x core/modules/user/src/UserAuthenticationInterface.php \Drupal\user\UserAuthenticationInterface

An interface for validating user authentication credentials.

Hierarchy

Expanded class hierarchy of UserAuthenticationInterface

All classes that implement UserAuthenticationInterface

3 files declare their use of UserAuthenticationInterface
BasicAuth.php in core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php
UserAuthenticationController.php in core/modules/user/src/Controller/UserAuthenticationController.php
UserLoginForm.php in core/modules/user/src/Form/UserLoginForm.php

File

core/modules/user/src/UserAuthenticationInterface.php, line 8

Namespace

Drupal\user
View source
interface UserAuthenticationInterface {
  
  /**
   * Validates user authentication credentials.
   *
   * @param string $identifier
   *   The user identifier to authenticate. Usually the username.
   *
   * @return Drupal\User\UserInterface|false
   *   The user account on success, or FALSE on failure to authenticate.
   */
  public function lookupAccount($identifier) : UserInterface|false;
  
  /**
   * Validates user authentication credentials for an account.
   *
   * This can be used where the account has already been located using the login
   * credentials.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The account to authenticate.
   * @param string $password
   *   A plain-text password, such as trimmed text from form values.
   *
   * @return bool
   *   TRUE on success, FALSE on failure.
   */
  public function authenticateAccount(UserInterface $account, #[\SensitiveParameter] string $password) : bool;

}

Members

Title Sort descending Modifiers Object type Summary Overrides
UserAuthenticationInterface::authenticateAccount public function Validates user authentication credentials for an account. 1
UserAuthenticationInterface::lookupAccount public function Validates user authentication credentials. 1

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.