UserAuthInterface.php

Same filename and directory in other branches
  1. 9 core/modules/user/src/UserAuthInterface.php
  2. 8.9.x core/modules/user/src/UserAuthInterface.php
  3. 11.x core/modules/user/src/UserAuthInterface.php

Namespace

Drupal\user

File

core/modules/user/src/UserAuthInterface.php

View source
<?php

namespace Drupal\user;


/**
 * An interface for validating user authentication credentials.
 */
interface UserAuthInterface {
    
    /**
     * Validates user authentication credentials.
     *
     * @param string $username
     *   The user name to authenticate.
     * @param string $password
     *   A plain-text password, such as trimmed text from form values.
     *
     * @return int|bool
     *   The user's uid on success, or FALSE on failure to authenticate.
     */
    public function authenticate($username, $password);
    
    /**
     * 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, string $password) : bool;

}

Interfaces

Title Deprecated Summary
UserAuthInterface An interface for validating user authentication credentials.

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