diff options
-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 |