public function ClientRepository::getClientEntity in Simple OAuth (OAuth2) & OpenID Connect 8.2
Same name and namespace in other branches
- 8.4 src/Repositories/ClientRepository.php \Drupal\simple_oauth\Repositories\ClientRepository::getClientEntity()
- 8.3 src/Repositories/ClientRepository.php \Drupal\simple_oauth\Repositories\ClientRepository::getClientEntity()
- 5.x src/Repositories/ClientRepository.php \Drupal\simple_oauth\Repositories\ClientRepository::getClientEntity()
File
- src/
Repositories/ ClientRepository.php, line 33
Class
Namespace
Drupal\simple_oauth\RepositoriesCode
public function getClientEntity($client_identifier, $grant_type, $client_secret = NULL, $must_validate_secret = TRUE) {
$client_drupal_entities = $this->entityTypeManager
->getStorage('oauth2_client')
->loadByProperties([
'uuid' => $client_identifier,
]);
// Check if the client is registered.
if (empty($client_drupal_entities)) {
return NULL;
}
/** @var \Drupal\simple_oauth\Entity\Oauth2ClientInterface $client_drupal_entity */
$client_drupal_entity = reset($client_drupal_entities);
if ($must_validate_secret && $client_drupal_entity
->isConfidential() && $this->passwordChecker
->check($client_secret, $client_drupal_entity
->getSecret()) === FALSE) {
return NULL;
}
return new ClientEntity($client_drupal_entity);
}