You are here

function openid_discovery in Drupal 7

Same name and namespace in other branches
  1. 6 modules/openid/openid.module \openid_discovery()

Perform discovery on a claimed ID to determine the OpenID provider endpoint.

Discovery methods are provided by the hook_openid_discovery_method_info and could be further altered using the hook_openid_discovery_method_info_alter.

Parameters

$claimed_id: The OpenID URL to perform discovery on.

Return value

The resulting discovery array from the first successful discovery method, which must contain following keys:

  • 'services' (required) an array of discovered services (including OpenID

version, endpoint URI, etc).

  • 'claimed_id' (optional) new claimed identifer, found by following HTTP

redirects during the services discovery. If all the discovery method fails or if no appropriate discovery method is found, FALSE is returned.

2 calls to openid_discovery()
openid_begin in modules/openid/openid.module
The initial step of OpenID authentication responsible for the following:
openid_complete in modules/openid/openid.module
Completes OpenID authentication by validating returned data from the OpenID Provider.

File

modules/openid/openid.module, line 419
Implement OpenID Relying Party support for Drupal

Code

function openid_discovery($claimed_id) {
  module_load_include('inc', 'openid');
  $methods = module_invoke_all('openid_discovery_method_info');
  drupal_alter('openid_discovery_method_info', $methods);

  // Execute each method in turn and return first successful discovery.
  foreach ($methods as $method) {
    $discovery = $method($claimed_id);
    if (!empty($discovery)) {
      return $discovery;
    }
  }
  return FALSE;
}