summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auth/OpenID/Consumer.php26
-rw-r--r--Auth/OpenID/Discover.php69
-rw-r--r--Services/Yadis/XRDS.php13
-rw-r--r--Tests/Auth/OpenID/Consumer.php58
-rw-r--r--Tests/Auth/OpenID/Discover.php30
-rw-r--r--Tests/Auth/OpenID/OpenID_Yadis.php17
6 files changed, 117 insertions, 96 deletions
diff --git a/Auth/OpenID/Consumer.php b/Auth/OpenID/Consumer.php
index 1e2233d..99a30db 100644
--- a/Auth/OpenID/Consumer.php
+++ b/Auth/OpenID/Consumer.php
@@ -385,9 +385,9 @@ class Auth_OpenID_Consumer {
if (in_array($response->status, array(Auth_OpenID_SUCCESS,
Auth_OpenID_CANCEL))) {
- if ($response->identity_url !== null) {
+ if ($response->claimed_id !== null) {
$disco = new Services_Yadis_Discovery($this->session,
- $response->identity_url,
+ $response->claimed_id,
$this->session_key_prefix);
$disco->cleanup();
}
@@ -536,7 +536,7 @@ class Auth_OpenID_GenericConsumer {
$error = $message->getArg(Auth_OpenID_OPENID_NS, 'error');
return new Auth_OpenID_FailureResponse($endpoint, $error);
} else if ($mode == 'id_res') {
- if ($endpoint->identity_url === null) {
+ if ($endpoint->claimed_id === null) {
return new Auth_OpenID_FailureResponse($endpoint,
"No session state found");
}
@@ -631,7 +631,7 @@ class Auth_OpenID_GenericConsumer {
}
//Fail if the identity field is present but not signed
- if (($endpoint->identity_url !== null) &&
+ if (($endpoint->claimed_id !== null) &&
(!in_array('identity', $signed_list))) {
$msg = '"openid.identity" not signed';
return new Auth_OpenID_FailureResponse($endpoint, $msg);
@@ -1019,7 +1019,7 @@ class Auth_OpenID_ConsumerResponse {
* that the supplied URL is, indeed controlled by the requesting
* agent. This has three relevant attributes:
*
- * identity_url - The identity URL that has been authenticated
+ * claimed_id - The identity URL that has been authenticated
*
* signed_args - The arguments in the server's response that were
* signed and verified.
@@ -1037,7 +1037,7 @@ class Auth_OpenID_SuccessResponse extends Auth_OpenID_ConsumerResponse {
function Auth_OpenID_SuccessResponse($endpoint, $message, $signed_args=null)
{
$this->endpoint = $endpoint;
- $this->identity_url = $endpoint->identity_url;
+ $this->claimed_id = $endpoint->claimed_id;
$this->signed_args = $signed_args;
$this->message = $message;
@@ -1127,7 +1127,7 @@ class Auth_OpenID_SuccessResponse extends Auth_OpenID_ConsumerResponse {
* OpenID protocol has failed. This could be locally or remotely
* triggered. This has three relevant attributes:
*
- * identity_url - The identity URL for which authentication was
+ * claimed_id - The identity URL for which authentication was
* attempted, if it can be determined. Otherwise, null.
*
* message - A message indicating why the request failed, if one is
@@ -1144,9 +1144,9 @@ class Auth_OpenID_FailureResponse extends Auth_OpenID_ConsumerResponse {
{
$this->endpoint = $endpoint;
if ($endpoint !== null) {
- $this->identity_url = $endpoint->identity_url;
+ $this->claimed_id = $endpoint->claimed_id;
} else {
- $this->identity_url = null;
+ $this->claimed_id = null;
}
$this->message = $message;
}
@@ -1157,7 +1157,7 @@ class Auth_OpenID_FailureResponse extends Auth_OpenID_ConsumerResponse {
* user cancelled the OpenID authentication request. This has two
* relevant attributes:
*
- * identity_url - The identity URL for which authentication was
+ * claimed_id - The identity URL for which authentication was
* attempted, if it can be determined. Otherwise, null.
*
* status - Auth_OpenID_SUCCESS.
@@ -1170,7 +1170,7 @@ class Auth_OpenID_CancelResponse extends Auth_OpenID_ConsumerResponse {
function Auth_OpenID_CancelResponse($endpoint)
{
$this->endpoint = $endpoint;
- $this->identity_url = $endpoint->identity_url;
+ $this->claimed_id = $endpoint->claimed_id;
}
}
@@ -1179,7 +1179,7 @@ class Auth_OpenID_CancelResponse extends Auth_OpenID_ConsumerResponse {
* that the request was in immediate mode, and the server is unable to
* authenticate the user without further interaction.
*
- * identity_url - The identity URL for which authentication was
+ * claimed_id - The identity URL for which authentication was
* attempted.
*
* setup_url - A URL that can be used to send the user to the server
@@ -1198,7 +1198,7 @@ class Auth_OpenID_SetupNeededResponse extends Auth_OpenID_ConsumerResponse {
$setup_url = null)
{
$this->endpoint = $endpoint;
- $this->identity_url = $endpoint->identity_url;
+ $this->claimed_id = $endpoint->claimed_id;
$this->setup_url = $setup_url;
}
}
diff --git a/Auth/OpenID/Discover.php b/Auth/OpenID/Discover.php
index 4d5a5f7..752f084 100644
--- a/Auth/OpenID/Discover.php
+++ b/Auth/OpenID/Discover.php
@@ -190,12 +190,11 @@ function Auth_OpenID_findOPLocalIdentifier($service, $type_uris)
$tags = $service->getElements($tag_name);
foreach ($tags as $tag) {
+ $content = $parser->content($tag);
+
if ($local_id === null) {
- $local_id = $parser->content($tag);
- } else if ($local_id != $parser->content($tag)) {
- // format = 'More than one %r tag found in one service element'
- // message = format % (local_id_tag,)
- // raise DiscoveryFailure(message, None)
+ $local_id = $content;
+ } else if ($local_id != $content) {
return false;
}
}
@@ -217,7 +216,7 @@ function filter_MatchesAnyOpenIDType(&$service)
return false;
}
-function Auth_OpenID_bestMatchingService($service)
+function Auth_OpenID_bestMatchingService($service, $preferred_types)
{
// Return the index of the first matching type, or something
// higher if no type matches.
@@ -245,7 +244,8 @@ function Auth_OpenID_arrangeByType($service_list, $preferred_types)
// comparison will prefer the one with the best matching service
$prio_services = array();
foreach ($service_list as $index => $service) {
- $prio_services[] = array(Auth_OpenID_bestMatchingService($service),
+ $prio_services[] = array(Auth_OpenID_bestMatchingService($service,
+ $preferred_types),
$index, $service);
}
@@ -282,15 +282,15 @@ function Auth_OpenID_getOPOrUserServices($openid_services)
}
}
-function Auth_OpenID_makeOpenIDEndpoints($uri, $endpoints)
+function Auth_OpenID_makeOpenIDEndpoints($uri, $yadis_services)
{
$s = array();
- if (!$endpoints) {
+ if (!$yadis_services) {
return $s;
}
- foreach ($endpoints as $service) {
+ foreach ($yadis_services as $service) {
$type_uris = $service->getTypes();
$uris = $service->getURIs();
@@ -298,7 +298,6 @@ function Auth_OpenID_makeOpenIDEndpoints($uri, $endpoints)
// specified, then this is an OpenID endpoint
if ($type_uris &&
$uris) {
-
foreach ($uris as $service_uri) {
$openid_endpoint = new Auth_OpenID_ServiceEndpoint();
if ($openid_endpoint->parseService($uri,
@@ -329,32 +328,32 @@ function Auth_OpenID_discoverWithYadis($uri, &$fetcher)
$response = Services_Yadis_Yadis::discover($uri, $http_response,
$fetcher);
+ $yadis_services = array();
+ $identity_url = null;
+
if ($response) {
$identity_url = $response->uri;
- $openid_services =
+ $yadis_services =
$response->xrds->services(array('filter_MatchesAnyOpenIDType'));
}
- if (!$openid_services) {
-
+ if (!$yadis_services) {
if (Services_Yadis_XRDS::parseXRDS($response->body) !== null) {
return @Auth_OpenID_discoverWithoutYadis($uri,
$fetcher);
}
- $body = $response->body;
-
// Try to parse the response as HTML to get OpenID 1.0/1.1
// <link rel="...">
- $openid_services = Auth_OpenID_ServiceEndpoint::fromHTML($identity_url,
- $body);
- // } else {
- // $openid_services = Auth_OpenID_makeOpenIDEndpoints($response->uri,
- // $openid_services);
+ $openid_services = Auth_OpenID_ServiceEndpoint::fromHTML(
+ $identity_url,
+ $response->body);
+ } else {
+ $openid_services = Auth_OpenID_makeOpenIDEndpoints($identity_url,
+ $yadis_services);
}
$openid_services = Auth_OpenID_getOPOrUserServices($openid_services);
-
return array($identity_url, $openid_services, $http_response);
}
@@ -385,29 +384,33 @@ function Auth_OpenID_discoverWithoutYadis($uri, &$fetcher)
// Try to parse the response as HTML to get OpenID 1.0/1.1 <link
// rel="...">
- $endpoint =& new Auth_OpenID_ServiceEndpoint();
- $openid_services = $endpoint->fromHTML($identity_url, $http_resp->body);
+ $openid_services = Auth_OpenID_ServiceEndpoint::fromHTML(
+ $identity_url,
+ $http_resp->body);
return array($identity_url, $openid_services, $http_resp);
}
function _Auth_OpenID_discoverXRI($iname, &$fetcher)
{
- $services = new Services_Yadis_ProxyResolver($fetcher);
- list($canonicalID, $service_list) =
- $services->query($iname,
+ $resolver = new Services_Yadis_ProxyResolver($fetcher);
+ list($canonicalID, $yadis_services) =
+ $resolver->query($iname,
Auth_OpenID_getOpenIDTypeURIs(),
array('filter_MatchesAnyOpenIDType'));
- for ($i = 0; $i < count($endpoints); $i++) {
- $endpoints[$i]->canonicalID = $canonicalID;
- $endpoints[$i]->claimed_id = $canonicalID;
- }
+ $openid_services = Auth_OpenID_makeOpenIDEndpoints($iname,
+ $yadis_services);
- $endpoints = Auth_OpenID_getOPOrUserServices($endpoints);
+ $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, $endpoints, null);
+ return array($iname, $openid_services, null);
}
function Auth_OpenID_discover($uri, &$fetcher)
diff --git a/Services/Yadis/XRDS.php b/Services/Yadis/XRDS.php
index 8b6c777..72a0d10 100644
--- a/Services/Yadis/XRDS.php
+++ b/Services/Yadis/XRDS.php
@@ -109,6 +109,19 @@ class Services_Yadis_Service {
return $t;
}
+ function matchTypes($type_uris)
+ {
+ $result = array();
+
+ foreach ($this->getTypes() as $typ) {
+ if (in_array($typ, $type_uris)) {
+ $result[] = $typ;
+ }
+ }
+
+ return $result;
+ }
+
/**
* Return the URIs in the "URI" elements, if any, of this Service
* element. The URIs are returned sorted in priority order.
diff --git a/Tests/Auth/OpenID/Consumer.php b/Tests/Auth/OpenID/Consumer.php
index 7477007..9ee0ce8 100644
--- a/Tests/Auth/OpenID/Consumer.php
+++ b/Tests/Auth/OpenID/Consumer.php
@@ -170,9 +170,9 @@ class Tests_Auth_OpenID_Consumer extends PHPUnit_TestCase {
$_Auth_OpenID_server_url;
$endpoint = new Auth_OpenID_ServiceEndpoint();
- $endpoint->identity_url = $user_url;
+ $endpoint->claimed_id = $user_url;
$endpoint->server_url = $_Auth_OpenID_server_url;
- $endpoint->delegate = $delegate_url;
+ $endpoint->local_id = $delegate_url;
$result = $consumer->begin($endpoint);
@@ -227,7 +227,7 @@ class Tests_Auth_OpenID_Consumer extends PHPUnit_TestCase {
$result = $consumer->complete($message, $result->endpoint);
$this->assertEquals(Auth_OpenID_SUCCESS, $result->status);
- $this->assertEquals($result->identity_url, $user_url);
+ $this->assertEquals($result->claimed_id, $user_url);
}
function _test_success($user_url, $delegate_url, $links, $immediate = false)
@@ -325,9 +325,9 @@ class _TestIdRes extends PHPUnit_TestCase {
$this->server_url = "serlie";
$this->consumer_id = "consu";
- $this->endpoint->identity_url = $this->consumer_id;
+ $this->endpoint->claimed_id = $this->consumer_id;
$this->endpoint->server_url = $this->server_url;
- $this->endpoint->delegate = $this->server_id;
+ $this->endpoint->local_id = $this->server_id;
}
}
@@ -371,7 +371,7 @@ class Tests_Auth_OpenID_Consumer_CheckNonceTest extends _TestIdRes {
$ret = $this->consumer->_checkNonce(null, $this->response);
$this->assertEquals($ret->status, Auth_OpenID_SUCCESS);
- $this->assertEquals($ret->identity_url, $this->consumer_id);
+ $this->assertEquals($ret->claimed_id, $this->consumer_id);
}
function test_serverNonce()
@@ -383,7 +383,7 @@ class Tests_Auth_OpenID_Consumer_CheckNonceTest extends _TestIdRes {
array('openid.nonce'));
$ret = $this->consumer->_checkNonce($this->server_url, $this->response);
$this->assertEquals($ret->status, Auth_OpenID_SUCCESS);
- $this->assertEquals($ret->identity_url, $this->consumer_id);
+ $this->assertEquals($ret->claimed_id, $this->consumer_id);
}
function test_badNonce()
@@ -402,7 +402,7 @@ class Tests_Auth_OpenID_Consumer_CheckNonceTest extends _TestIdRes {
$ret = $this->consumer->_checkNonce($this->server_url, $this->response);
$this->assertEquals($ret->status, Auth_OpenID_FAILURE);
- $this->assertEquals($ret->identity_url, $this->consumer_id);
+ $this->assertEquals($ret->claimed_id, $this->consumer_id);
$this->assertTrue(strpos($ret->message, 'Nonce missing from store') === 0);
}
@@ -417,7 +417,7 @@ class Tests_Auth_OpenID_Consumer_CheckNonceTest extends _TestIdRes {
$ret = $this->consumer->_checkNonce($this->server_url, $this->response);
$this->assertEquals($ret->status, Auth_OpenID_FAILURE);
- $this->assertEquals($ret->identity_url, $this->consumer_id);
+ $this->assertEquals($ret->claimed_id, $this->consumer_id);
$this->assertTrue(strpos($ret->message, 'Malformed nonce') === 0, $ret->message);
}
@@ -432,7 +432,7 @@ class Tests_Auth_OpenID_Consumer_CheckNonceTest extends _TestIdRes {
$ret = $this->consumer->_checkNonce($this->server_url, $this->response);
$this->assertEquals($ret->status, Auth_OpenID_FAILURE);
- $this->assertEquals($ret->identity_url, $this->consumer_id);
+ $this->assertEquals($ret->claimed_id, $this->consumer_id);
$this->assertTrue(strpos($ret->message,
'Nonce missing from return_to') === 0);
}
@@ -508,7 +508,7 @@ class Tests_Auth_OpenID_Consumer_TestCheckAuthTriggered extends _TestIdRes {
$info = $this->_doIdRes($message);
$this->assertEquals('failure', $info->status);
- $this->assertEquals($this->consumer_id, $info->identity_url);
+ $this->assertEquals($this->consumer_id, $info->claimed_id);
$this->assertTrue(strpos($info->message, 'expired') !== false);
}
@@ -541,7 +541,7 @@ class Tests_Auth_OpenID_Consumer_TestCheckAuthTriggered extends _TestIdRes {
$info = $this->_doIdRes($message);
$this->assertEquals($info->status, 'success');
- $this->assertEquals($this->consumer_id, $info->identity_url);
+ $this->assertEquals($this->consumer_id, $info->claimed_id);
}
}
@@ -574,7 +574,7 @@ class Tests_Auth_OpenID_Complete extends _TestIdRes {
$r = $this->consumer->complete($message, $this->endpoint);
$this->assertEquals($r->status, Auth_OpenID_CANCEL);
- $this->assertTrue($r->identity_url == $this->endpoint->identity_url);
+ $this->assertTrue($r->claimed_id == $this->endpoint->claimed_id);
}
function test_error()
@@ -585,7 +585,7 @@ class Tests_Auth_OpenID_Complete extends _TestIdRes {
$message = Auth_OpenID_Message::fromPostArgs($query);
$r = $this->consumer->complete($message, $this->endpoint);
$this->assertEquals($r->status, Auth_OpenID_FAILURE);
- $this->assertTrue($r->identity_url == $this->endpoint->identity_url);
+ $this->assertTrue($r->claimed_id == $this->endpoint->claimed_id);
$this->assertEquals($r->message, $msg);
}
@@ -595,7 +595,7 @@ class Tests_Auth_OpenID_Complete extends _TestIdRes {
$message = Auth_OpenID_Message::fromPostArgs($query);
$r = $this->consumer->complete($message, $this->endpoint);
$this->assertEquals($r->status, Auth_OpenID_FAILURE);
- $this->assertTrue($r->identity_url == $this->endpoint->identity_url);
+ $this->assertTrue($r->claimed_id == $this->endpoint->claimed_id);
}
function test_idResMissingField()
@@ -604,7 +604,7 @@ class Tests_Auth_OpenID_Complete extends _TestIdRes {
$message = Auth_OpenID_Message::fromPostArgs($query);
$r = $this->consumer->complete($message, $this->endpoint);
$this->assertEquals($r->status, Auth_OpenID_FAILURE);
- $this->assertEquals($r->identity_url, $this->consumer_id);
+ $this->assertEquals($r->claimed_id, $this->consumer_id);
}
function test_idResURLMismatch()
@@ -616,7 +616,7 @@ class Tests_Auth_OpenID_Complete extends _TestIdRes {
$message = Auth_OpenID_Message::fromPostArgs($query);
$r = $this->consumer->complete($message, $this->endpoint);
$this->assertEquals($r->status, Auth_OpenID_FAILURE);
- $this->assertEquals($r->identity_url, $this->consumer_id);
+ $this->assertEquals($r->claimed_id, $this->consumer_id);
$this->assertTrue(strpos($r->message, 'delegate') !== false);
}
}
@@ -727,7 +727,7 @@ class Tests_Auth_OpenID_FetchErrorInIdRes extends _TestIdRes {
$message = Auth_OpenID_Message::fromPostArgs($query);
$r = $this->consumer->complete($message, $this->endpoint);
$this->assertEquals($r->status, Auth_OpenID_FAILURE);
- $this->assertEquals($r->identity_url, $this->consumer_id);
+ $this->assertEquals($r->claimed_id, $this->consumer_id);
$this->assertEquals($this->consumer->message, $r->message);
}
}
@@ -857,7 +857,7 @@ class Tests_Auth_OpenID_AuthRequest extends PHPUnit_TestCase {
function setUp()
{
$this->endpoint = new Auth_OpenID_ServiceEndpoint();
- $this->endpoint->delegate = 'http://server.unittest/joe';
+ $this->endpoint->local_id = 'http://server.unittest/joe';
$this->endpoint->server_url = 'http://server.unittest/';
$this->assoc =& $this;
$this->assoc->handle = 'assoc@handle';
@@ -883,7 +883,7 @@ class Tests_Auth_OpenID_SuccessResponse extends PHPUnit_TestCase {
function setUp()
{
$this->endpoint = new Auth_OpenID_ServiceEndpoint();
- $this->endpoint->identity_url = 'identity_url';
+ $this->endpoint->claimed_id = 'identity_url';
}
function test_extensionResponse()
@@ -1148,14 +1148,14 @@ class Tests_Auth_OpenID_ConsumerTest2 extends PHPUnit_TestCase {
}
$this->endpoint = new Auth_OpenID_ServiceEndpoint();
- $this->identity_url = 'http://identity.url/';
- $this->endpoint->identity_url = $this->identity_url;
+ $this->claimed_id = 'http://identity.url/';
+ $this->endpoint->claimed_id = $this->claimed_id;
$this->store = null;
$this->session = new Services_Yadis_PHPSession();
$this->consumer =& new Auth_OpenID_Consumer($this->store, &$this->session);
$this->consumer->consumer =& new _StubConsumer();
$this->discovery =& new Services_Yadis_Discovery(&$this->session,
- $this->identity_url,
+ $this->claimed_id,
$this->consumer->session_key_prefix);
}
@@ -1186,7 +1186,7 @@ class Tests_Auth_OpenID_ConsumerTest2 extends PHPUnit_TestCase {
{
$response = $this->consumer->complete(array());
$this->assertEquals($response->status, Auth_OpenID_FAILURE);
- $this->assertTrue($response->identity_url === null);
+ $this->assertTrue($response->claimed_id === null);
}
function _doResp($auth_req, $exp_resp)
@@ -1202,7 +1202,7 @@ class Tests_Auth_OpenID_ConsumerTest2 extends PHPUnit_TestCase {
// All responses should have the same identity URL, and the
// session should be cleaned out
- $this->assertTrue($resp->identity_url == $this->identity_url);
+ $this->assertTrue($resp->claimed_id == $this->claimed_id);
$this->assertFalse(in_array($this->consumer->_token_key,
$_SESSION)); // this->session->data));
@@ -1256,8 +1256,8 @@ class Tests_Auth_OpenID_ConsumerTest2 extends PHPUnit_TestCase {
{
// Set up and execute a transaction, with discovery
$this->discovery->createManager(array($this->endpoint),
- $this->identity_url);
- $auth_req = $this->consumer->begin($this->identity_url);
+ $this->claimed_id);
+ $auth_req = $this->consumer->begin($this->claimed_id);
$resp = $this->_doResp($auth_req, $exp_resp);
$manager = $this->discovery->getManager();
@@ -1306,9 +1306,9 @@ class Tests_Auth_OpenID_ConsumerTest2 extends PHPUnit_TestCase {
function test_begin()
{
$this->discovery->createManager(array($this->endpoint),
- $this->identity_url);
+ $this->claimed_id);
// Should not raise an exception
- $auth_req = $this->consumer->begin($this->identity_url);
+ $auth_req = $this->consumer->begin($this->claimed_id);
$this->assertTrue(strtolower(get_class($auth_req)) === 'auth_openid_authrequest');
$this->assertTrue($auth_req->endpoint == $this->endpoint);
$this->assertTrue($auth_req->endpoint == $this->consumer->consumer->endpoint);
diff --git a/Tests/Auth/OpenID/Discover.php b/Tests/Auth/OpenID/Discover.php
index 2afeca5..06ff4d2 100644
--- a/Tests/Auth/OpenID/Discover.php
+++ b/Tests/Auth/OpenID/Discover.php
@@ -26,9 +26,9 @@ class _SimpleMockFetcher {
}
}
-class Tests_Services_Yadis_DiscoveryFailure extends PHPUnit_TestCase {
+class Tests_Auth_OpenID_DiscoveryFailure extends PHPUnit_TestCase {
- function Tests_Services_Yadis_DiscoveryFailure($responses)
+ function Tests_Auth_OpenID_DiscoveryFailure($responses)
{
// Response is ($code, $url, $body).
$this->cases = array(
@@ -364,7 +364,7 @@ class Tests_Auth_OpenID_DiscoverSession {
}
$__Tests_BOGUS_SERVICE = new Auth_OpenID_ServiceEndpoint();
-$__Tests_BOGUS_SERVICE->identity_url = "=really.bogus.endpoint";
+$__Tests_BOGUS_SERVICE->claimed_id = "=really.bogus.endpoint";
function __serviceCheck_discover_cb($url, $fetcher)
{
@@ -414,10 +414,10 @@ class Tests_Auth_OpenID_Discover extends _DiscoveryBase {
$this->assertEquals($services[0]->server_url,
"http://www.myopenid.com/server");
- $this->assertEquals($services[0]->delegate,
+ $this->assertEquals($services[0]->local_id,
"http://smoker.myopenid.com/");
- $this->assertEquals($services[0]->identity_url, $this->id_url);
+ $this->assertEquals($services[0]->claimed_id, $this->id_url);
$this->_notUsedYadis($services[0]);
}
@@ -442,7 +442,7 @@ class Tests_Auth_OpenID_Discover extends _DiscoveryBase {
foreach ($expected as $openid) {
$s = $m->getNextService('_Auth_OpenID_discoverServiceList',
$fetcher);
- $this->assertEquals($s->delegate, $openid);
+ $this->assertEquals($s->local_id, $openid);
}
}
@@ -470,8 +470,8 @@ class Tests_Auth_OpenID_Discover extends _DiscoveryBase {
$newMan = $disco->getManager();
$currentService = $newMan->_current;
- $this->assertEquals($currentService->identity_url,
- $__Tests_BOGUS_SERVICE->identity_url);
+ $this->assertEquals($currentService->claimed_id,
+ $__Tests_BOGUS_SERVICE->claimed_id);
}
function test_noOpenID()
@@ -535,10 +535,10 @@ class Tests_Auth_OpenID_Discover extends _DiscoveryBase {
$this->assertEquals($services[0]->server_url,
"http://www.myopenid.com/server");
- $this->assertEquals($services[0]->delegate,
+ $this->assertEquals($services[0]->local_id,
"http://smoker.myopenid.com/");
- $this->assertEquals($services[0]->identity_url,
+ $this->assertEquals($services[0]->claimed_id,
$expected_final_url);
$this->_notUsedYadis($services[0]);
@@ -580,7 +580,7 @@ class Tests_Auth_OpenID_Discover extends _DiscoveryBase {
$this->assertEquals($services[0]->server_url,
"http://www.myopenid.com/server");
- $this->assertEquals($services[0]->identity_url, $this->id_url);
+ $this->assertEquals($services[0]->claimed_id, $this->id_url);
$this->_notUsedYadis($services[0]);
}
@@ -603,7 +603,7 @@ class Tests_Auth_OpenID_Discover extends _DiscoveryBase {
$this->assertEquals($services[0]->server_url,
"http://www.myopenid.com/server");
- $this->assertEquals($services[0]->delegate, null,
+ $this->assertEquals($services[0]->local_id, null,
'Delegate should be null');
$this->_usedYadis($services[0]);
@@ -625,9 +625,9 @@ class Tests_Auth_OpenID_Discover extends _DiscoveryBase {
$this->assertEquals($services[0]->server_url,
"http://www.myopenid.com/server");
- $this->assertEquals($services[0]->identity_url, $this->id_url);
+ $this->assertEquals($services[0]->claimed_id, $this->id_url);
- $this->assertEquals($services[0]->delegate, null,
+ $this->assertEquals($services[0]->local_id, null,
'Delegate should be null');
$this->_notUsedYadis($services[0]);
@@ -661,7 +661,7 @@ class Tests_Auth_OpenID_Discover extends _DiscoveryBase {
// with XRI.
$endpoint = new Auth_OpenID_ServiceEndpoint();
- $endpoint->identity_url = "=example";
+ $endpoint->claimed_id = "=example";
$endpoint->canonicalID = Services_Yadis_XRI("=!1000");
$this->assertEquals($endpoint->getLocalID(), Services_Yadis_XRI("=!1000"));
}
diff --git a/Tests/Auth/OpenID/OpenID_Yadis.php b/Tests/Auth/OpenID/OpenID_Yadis.php
index 39c96b8..a49b3ba 100644
--- a/Tests/Auth/OpenID/OpenID_Yadis.php
+++ b/Tests/Auth/OpenID/OpenID_Yadis.php
@@ -40,8 +40,7 @@ $__ext_types = array(
// endpoint
$__openid_types = array(
Auth_OpenID_TYPE_1_0,
- Auth_OpenID_TYPE_1_1,
- Auth_OpenID_TYPE_1_2);
+ Auth_OpenID_TYPE_1_1);
$temp = array();
foreach (__subsets($__ext_types) as $exts) {
@@ -140,7 +139,7 @@ class Tests_Auth_OpenID_Tester extends PHPUnit_TestCase {
{
$this->uris = $uris;
$this->type_uris = $type_uris;
- $this->delegate = $delegate;
+ $this->local_id = $delegate;
parent::PHPUnit_TestCase();
}
@@ -151,7 +150,7 @@ class Tests_Auth_OpenID_Tester extends PHPUnit_TestCase {
// Create an XRDS document to parse
$services = _mkService($this->uris,
$this->type_uris,
- $this->delegate);
+ $this->local_id);
$this->xrds = _mkXRDS($services);
}
@@ -183,10 +182,16 @@ class Tests_Auth_OpenID_Tester extends PHPUnit_TestCase {
$seen_uris[] = $endpoint->server_url;
// All endpoints will have same yadis_url
- $this->assertEquals($this->yadis_url, $endpoint->identity_url);
+ $this->assertEquals($this->yadis_url, $endpoint->claimed_id);
+
+
+ if ($this->local_id != $endpoint->local_id) {
+ print "Expected: ".$this->local_id."\n";
+ print_r($endpoint);
+ }
// and delegate
- $this->assertEquals($this->delegate, $endpoint->delegate);
+ $this->assertEquals($this->local_id, $endpoint->local_id);
// and types
$actual_types = $endpoint->type_uris;