diff options
author | tailor <cygnus@janrain.com> | 2006-08-21 19:53:01 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2006-08-21 19:53:01 +0000 |
commit | 0dbfc9a22220906312f445106f9b4bf30d0a27b1 (patch) | |
tree | b57a8c8d5906b477111542c485f23e2ae9dd6d34 | |
parent | fb33c3120082c30424a638d9e1a8a5a665c0efaf (diff) | |
download | php-openid-0dbfc9a22220906312f445106f9b4bf30d0a27b1.zip php-openid-0dbfc9a22220906312f445106f9b4bf30d0a27b1.tar.gz php-openid-0dbfc9a22220906312f445106f9b4bf30d0a27b1.tar.bz2 |
[project @ Fixed getServerID to return canonicalID when there is no delegate.]
-rw-r--r-- | Auth/OpenID/Discover.php | 6 | ||||
-rw-r--r-- | Tests/Auth/OpenID/Discover.php | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/Auth/OpenID/Discover.php b/Auth/OpenID/Discover.php index 16c36a6..4b349d1 100644 --- a/Auth/OpenID/Discover.php +++ b/Auth/OpenID/Discover.php @@ -74,7 +74,11 @@ class Auth_OpenID_ServiceEndpoint { // Return the identifier that should be sent as the // openid.identity_url parameter to the server. if ($this->delegate === null) { - return $this->identity_url; + if ($this->canonicalID) { + return $this->canonicalID; + } else { + return $this->identity_url; + } } else { return $this->delegate; } diff --git a/Tests/Auth/OpenID/Discover.php b/Tests/Auth/OpenID/Discover.php index 4ed0063..f3e3eb7 100644 --- a/Tests/Auth/OpenID/Discover.php +++ b/Tests/Auth/OpenID/Discover.php @@ -617,6 +617,17 @@ class Tests_Auth_OpenID_Discover extends _DiscoveryBase { "http://www.livejournal.com/openid/server.bml"); $this->assertEquals($services[0]->canonicalID, Services_Yadis_XRI("=!1000")); } + + function test_useCanonicalID() + { + // When there is no delegate, the CanonicalID should be used + // with XRI. + + $endpoint = new Auth_OpenID_ServiceEndpoint(); + $endpoint->identity_url = "=example"; + $endpoint->canonicalID = Services_Yadis_XRI("=!1000"); + $this->assertEquals($endpoint->getServerID(), Services_Yadis_XRI("=!1000")); + } } ?>
\ No newline at end of file |