protected function ClientCredentialsOverrideGrant::getDefaultUser in Simple OAuth (OAuth2) & OpenID Connect 8.4
Same name and namespace in other branches
- 5.x src/Grant/ClientCredentialsOverrideGrant.php \Drupal\simple_oauth\Grant\ClientCredentialsOverrideGrant::getDefaultUser()
Finds the default user for the client.
Parameters
\League\OAuth2\Server\Entities\ClientEntityInterface $client: The League's client.
Return value
\Drupal\user\Entity\User The default user.
Throws
\Drupal\Component\Plugin\Exception\PluginException
1 call to ClientCredentialsOverrideGrant::getDefaultUser()
File
- src/
Grant/ ClientCredentialsOverrideGrant.php, line 59
Class
- ClientCredentialsOverrideGrant
- Injects the user information in the client credentials token.
Namespace
Drupal\simple_oauth\GrantCode
protected function getDefaultUser(ClientEntityInterface $client) {
$client_drupal_entities = \Drupal::entityTypeManager()
->getStorage('consumer')
->loadByProperties([
'uuid' => $client
->getIdentifier(),
]);
$client_drupal_entity = reset($client_drupal_entities);
return $client_drupal_entity ? $client_drupal_entity
->get('user_id')->target_id : NULL;
}