public function ClientRepository::getClientEntity in Simple OAuth (OAuth2) & OpenID Connect 8.3
Same name and namespace in other branches
- 8.4 src/Repositories/ClientRepository.php \Drupal\simple_oauth\Repositories\ClientRepository::getClientEntity()
- 8.2 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 = NULL, $client_secret = NULL, $must_validate_secret = TRUE) {
$client_drupal_entities = $this->entityTypeManager
->getStorage('consumer')
->loadByProperties([
'uuid' => $client_identifier,
]);
// Check if the client is registered.
if (empty($client_drupal_entities)) {
return NULL;
}
/** @var \Drupal\consumers\Entity\Consumer $client_drupal_entity */
$client_drupal_entity = reset($client_drupal_entities);
$secret = $client_drupal_entity
->get('secret')->value;
if ($must_validate_secret && $client_drupal_entity
->get('confidential')->value && $this->passwordChecker
->check($client_secret, $secret) === FALSE) {
return NULL;
}
return new ClientEntity($client_drupal_entity);
}