class UserRepository in Simple OAuth (OAuth2) & OpenID Connect 8.4
Same name and namespace in other branches
- 8.2 src/Repositories/UserRepository.php \Drupal\simple_oauth\Repositories\UserRepository
- 8.3 src/Repositories/UserRepository.php \Drupal\simple_oauth\Repositories\UserRepository
- 5.x src/Repositories/UserRepository.php \Drupal\simple_oauth\Repositories\UserRepository
Hierarchy
- class \Drupal\simple_oauth\Repositories\UserRepository implements \League\OAuth2\Server\Repositories\UserRepositoryInterface
Expanded class hierarchy of UserRepository
1 string reference to 'UserRepository'
1 service uses UserRepository
File
- src/
Repositories/ UserRepository.php, line 11
Namespace
Drupal\simple_oauth\RepositoriesView source
class UserRepository implements UserRepositoryInterface {
/**
* @var \Drupal\user\UserAuthInterface
*/
protected $userAuth;
/**
* UserRepository constructor.
*
* @param \Drupal\user\UserAuthInterface $user_auth
* The service to check the user authentication.
*/
public function __construct(UserAuthInterface $user_auth) {
$this->userAuth = $user_auth;
}
/**
* {@inheritdoc}
*/
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;
}
throw OAuthServerException::invalidCredentials();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UserRepository:: |
protected | property | ||
UserRepository:: |
public | function | ||
UserRepository:: |
public | function | UserRepository constructor. |