You are here

public function OpenIdConnectScopeRepository::getScopeEntityByIdentifier in Simple OAuth (OAuth2) & OpenID Connect 5.x

File

src/OpenIdConnect/OpenIdConnectScopeRepository.php, line 38

Class

OpenIdConnectScopeRepository
OpenID Connect scope repository decorator.

Namespace

Drupal\simple_oauth\OpenIdConnect

Code

public function getScopeEntityByIdentifier($identifier) {

  // First check if this scope exists as a role.
  $role_scope = $this->innerScopeRepository
    ->getScopeEntityByIdentifier($identifier);
  if ($role_scope) {
    return $role_scope;
  }

  // Fall back to a fixed list of OpenID scopes.
  $openid_scopes = $this
    ->getOpenIdScopes();
  if (isset($openid_scopes[$identifier])) {
    return new OpenIdConnectScopeEntity($identifier, $openid_scopes[$identifier]);
  }
  return NULL;
}