作者:BGCX06
项目:ezopenid-svn-to-gi
function runTest()
{
// Parse into endpoint objects that we will check
$xrds_object = Auth_Yadis_XRDS::parseXRDS($this->xrds);
$endpoints = array();
if ($xrds_object) {
$endpoints = $xrds_object->services(array('filter_MatchesAnyOpenIDType'));
$endpoints = Auth_OpenID_makeOpenIDEndpoints($this->yadis_url, $endpoints);
}
// make sure there are the same number of endpoints as
// URIs. This assumes that the type_uris contains at least one
// OpenID type.
$this->assertEquals(count($this->uris), count($endpoints), "URI <-> Endpoint count");
// So that we can check equality on the endpoint types
$type_uris = $this->type_uris;
sort($type_uris);
$seen_uris = array();
foreach ($endpoints as $endpoint) {
$seen_uris[] = $endpoint->server_url;
// All endpoints will have same yadis_url
$this->assertEquals($this->yadis_url, $endpoint->claimed_id);
// and delegate
$this->assertEquals($this->local_id, $endpoint->local_id);
// and types
$actual_types = $endpoint->type_uris;
sort($actual_types);
$this->assertEquals($actual_types, $type_uris);
}
// So that they will compare equal, because we don't care what
// order they are in
sort($seen_uris);
$uris = $this->uris;
sort($uris);
// Make sure we saw all URIs, and saw each one once
$this->assertEquals($uris, $seen_uris);
}
作者:remotelearne
项目:elis.openi
function discover_user($domain, $claimed_id, $fetcher)
{
$site_url = $this->fetch_host_meta($domain, $fetcher);
if ($site_url == null) {
return;
}
$site_xrds = $this->fetch_xrds_services($domain, $site_url, $fetcher);
list($user_url, $next_authority) = $this->get_user_xrds_url($site_xrds, $claimed_id);
$user_xrds = $this->fetch_xrds_services($next_authority, $user_url, $fetcher, false);
if ($user_xrds != null) {
$services = $user_xrds->services(array('filter_MatchesAnyOpenIDType'));
$endpoints = Auth_OpenID_makeOpenIDEndpoints($claimed_id, $services);
return array($claimed_id, $endpoints);
}
}
作者:Tjorriemorri
项目:ap
function _Auth_OpenID_discoverXRI($iname, &$fetcher)
{
$services = new Services_Yadis_ProxyResolver($fetcher);
list($canonicalID, $service_list) = $services->query($iname, array(_OPENID_1_0_TYPE, _OPENID_1_1_TYPE, _OPENID_1_2_TYPE), array('filter_MatchesAnyOpenIDType'));
$endpoints = Auth_OpenID_makeOpenIDEndpoints($iname, $service_list);
for ($i = 0; $i < count($endpoints); $i++) {
$endpoints[$i]->canonicalID = $canonicalID;
}
// FIXME: returned xri should probably be in some normal form
return array($iname, $endpoints, null);
}
作者:openi
项目:php-openi
static function fromXRDS($uri, $xrds_text)
{
$xrds = Auth_Yadis_XRDS::parseXRDS($xrds_text);
if ($xrds) {
$yadis_services = $xrds->services(array('filter_MatchesAnyOpenIDType'));
return Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services);
}
return null;
}
作者:ramziamma
项目:website
function Auth_OpenID_discoverXRI($iname, &$fetcher)
{
$resolver = new Auth_Yadis_ProxyResolver($fetcher);
list($canonicalID, $yadis_services) = $resolver->query($iname, Auth_OpenID_getOpenIDTypeURIs(), array('filter_MatchesAnyOpenIDType'));
$openid_services = Auth_OpenID_makeOpenIDEndpoints($iname, $yadis_services);
$openid_services = Auth_OpenID_getOPOrUserServices($openid_services);
for ($i = 0; $i < count($openid_services); $i++) {
$openid_services[$i]->canonicalID = $canonicalID;
$openid_services[$i]->claimed_id = $canonicalID;
}
// FIXME: returned xri should probably be in some normal form
return array($iname, $openid_services);
}