_openid_xri_discovery

function _openid_xri_discovery

_openid_xri_discovery($claimed_id)

OpenID discovery method: perform an XRI discovery.

Return value

An array of discovered services and claimed identifier or NULL. See openid_discovery() for more specific information.

See also

http://openid.net/specs/openid-authentication-2_0.html#discovery

hook_openid_discovery_method_info()

openid_discovery()

File

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

Code

function _openid_xri_discovery($claimed_id) {
  if (_openid_is_xri($claimed_id)) {
    // Resolve XRI using a proxy resolver (Extensible Resource Identifier (XRI)
    // Resolution Version 2.0, section 11.2 and 14.3).
    $xrds_url = variable_get('xri_proxy_resolver', 'http://xri.net/') . rawurlencode($claimed_id) . '?_xrd_r=application/xrds+xml';
    $discovery = _openid_xrds_discovery($xrds_url);
    if (!empty($discovery['services']) && is_array($discovery['services'])) {
      foreach ($discovery['services'] as $i => &$service) {
        $status = $service['xrd']->children(OPENID_NS_XRD)->Status;
        if ($status && $status->attributes()->cid == 'verified') {
          $service['claimed_id'] = openid_normalize((string) $service['xrd']->children(OPENID_NS_XRD)->CanonicalID);
        }
        else {
          // Ignore service if the Canonical ID could not be verified.
          unset($discovery['services'][$i]);
        }
      }
      if (!empty($discovery['services'])) {
        return $discovery;
      }
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!openid!openid.module/function/_openid_xri_discovery/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部