You are here

function openid_connect_get_scopes in OpenID Connect / OAuth client 7

Returns scopes that have to be requested based on the configured claims.

Return value

string Space delimited case sensitive list of ASCII scope values.

See also

http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims

2 calls to openid_connect_get_scopes()
openid_connect_connect_form_submit in includes/openid_connect.forms.inc
Submit callback for the connect account form.
openid_connect_login_form_submit in includes/openid_connect.forms.inc
Form submit handler: Log in with an OpenID Connect login provider.

File

./openid_connect.module, line 617
A pluggable client implementation for the OpenID Connect protocol.

Code

function openid_connect_get_scopes() {
  $claims = variable_get('openid_connect_userinfo_mapping_claims', array());
  $scopes = array(
    'openid',
    'email',
  );
  $claims_info = openid_connect_claims();
  foreach ($claims as $claim) {
    if (isset($claims_info[$claim]) && !isset($scopes[$claims_info[$claim]['scope']]) && $claim != 'email') {
      $scopes[$claims_info[$claim]['scope']] = $claims_info[$claim]['scope'];
    }
  }
  return implode(' ', $scopes);
}