You are here

function openid_connect_get_connected_accounts in OpenID Connect / OAuth client 7

Get a list of external OIDC accounts connected to this Drupal account.

Parameters

object $account: A Drupal user entity.

Return value

array An array of 'sub' properties keyed by the client name.

3 calls to openid_connect_get_connected_accounts()
openid_connect_connect_form in includes/openid_connect.forms.inc
Form builder: Connect an external account to your existing Drupal account.
openid_connect_set_password_access in ./openid_connect.module
Find whether the user is allowed to change their own password.
_openid_connect_user_pass_form_validate in ./openid_connect.module
Custom validation for the password reset form.

File

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

Code

function openid_connect_get_connected_accounts($account) {
  $auth_maps = db_query("SELECT module, authname FROM {authmap} WHERE uid = :uid AND module LIKE 'openid_connect_%'", array(
    ':uid' => $account->uid,
  ));
  $module_offset = strlen('openid_connect_');
  $results = array();
  foreach ($auth_maps as $auth_map) {
    $client = substr($auth_map->module, $module_offset);
    $sub = $auth_map->authname;
    $results[$client] = $sub;
  }
  return $results;
}