class UserIdentityProvider in Simple OAuth (OAuth2) & OpenID Connect 5.x
A user identity provider for the OpenID Connect integration.
Hierarchy
- class \Drupal\simple_oauth\OpenIdConnect\UserIdentityProvider implements \OpenIDConnectServer\Repositories\IdentityProviderInterface
Expanded class hierarchy of UserIdentityProvider
File
- src/
OpenIdConnect/ UserIdentityProvider.php, line 13
Namespace
Drupal\simple_oauth\OpenIdConnectView source
class UserIdentityProvider implements IdentityProviderInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* UserIdentityProvider constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public function getUserEntityByIdentifier($identifier) {
$user = $this->entityTypeManager
->getStorage('user')
->load($identifier);
assert($user instanceof UserInterface);
$user_entity = new UserEntityWithClaims();
$user_entity
->setIdentifier($identifier);
$claims = \Drupal::service('serializer')
->normalize($user_entity, 'json', [
$identifier => $user,
]);
$user_entity
->setClaims($claims);
return $user_entity;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UserIdentityProvider:: |
protected | property | The entity type manager. | |
UserIdentityProvider:: |
public | function | ||
UserIdentityProvider:: |
public | function | UserIdentityProvider constructor. |