You are here

public function OAuth2Storage::checkUserCredentials in OAuth2 Server 2.0.x

Same name and namespace in other branches
  1. 8 src/OAuth2Storage.php \Drupal\oauth2_server\OAuth2Storage::checkUserCredentials()

Check user credentials.

Parameters

string $username: The username string.

string $password: The password string.

Return value

bool Whether the credentials are valid or not.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

src/OAuth2Storage.php, line 690

Class

OAuth2Storage
Provides Drupal OAuth2 storage for the library.

Namespace

Drupal\oauth2_server

Code

public function checkUserCredentials($username, $password) {
  $account = $this
    ->getStorageAccount($username);
  if ($account && $account
    ->isActive()) {
    return $this->passwordHasher
      ->check($password, $account
      ->getPassword());
  }
  return FALSE;
}