You are here

public function UserRepository::getUserEntityByUserCredentials in Simple OAuth (OAuth2) & OpenID Connect 8.2

Same name and namespace in other branches
  1. 8.4 src/Repositories/UserRepository.php \Drupal\simple_oauth\Repositories\UserRepository::getUserEntityByUserCredentials()
  2. 8.3 src/Repositories/UserRepository.php \Drupal\simple_oauth\Repositories\UserRepository::getUserEntityByUserCredentials()
  3. 5.x src/Repositories/UserRepository.php \Drupal\simple_oauth\Repositories\UserRepository::getUserEntityByUserCredentials()

File

src/Repositories/UserRepository.php, line 30

Class

UserRepository

Namespace

Drupal\simple_oauth\Repositories

Code

public function getUserEntityByUserCredentials($username, $password, $grantType, ClientEntityInterface $clientEntity) {

  // TODO: Use authenticateWithFloodProtection when #2825084 lands.
  if ($uid = $this->userAuth
    ->authenticate($username, $password)) {
    $user = new UserEntity();
    $user
      ->setIdentifier($uid);
    return $user;
  }
  return NULL;
}