summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auth/OpenID/Consumer.php15
-rw-r--r--Auth/OpenID/Discover.php14
2 files changed, 28 insertions, 1 deletions
diff --git a/Auth/OpenID/Consumer.php b/Auth/OpenID/Consumer.php
index 0c5ce82..8f12386 100644
--- a/Auth/OpenID/Consumer.php
+++ b/Auth/OpenID/Consumer.php
@@ -850,8 +850,15 @@ class Auth_OpenID_GenericConsumer {
"Missing required field openid.identity");
}
+ $to_match_1_0 = $to_match->copy();
+ $to_match_1_0->type_uris = array(Auth_OpenID_TYPE_1_0);
+
$result = $this->_verifyDiscoverySingle($endpoint, $to_match);
+ if (is_a($result, 'Auth_OpenID_TypeURIMismatch')) {
+ $result = $this->_verifyDiscoverySingle($endpoint, $to_match_1_0);
+ }
+
if (is_a($result, 'Auth_OpenID_FailureResponse')) {
return $result;
} else {
@@ -865,7 +872,7 @@ class Auth_OpenID_GenericConsumer {
// present in the discovered endpoint.
foreach ($to_match->type_uris as $type_uri) {
if (!$endpoint->usesExtension($type_uri)) {
- return new Auth_OpenID_FailureResponse($endpoint,
+ return new Auth_OpenID_TypeURIMismatch($endpoint,
"Required type ".$type_uri." not present");
}
}
@@ -1699,6 +1706,12 @@ class Auth_OpenID_FailureResponse extends Auth_OpenID_ConsumerResponse {
}
/**
+ * A specific, internal failure used to detect type URI mismatch.
+ */
+class Auth_OpenID_TypeURIMismatch extends Auth_OpenID_FailureResponse {
+}
+
+/**
* A response with a status of Auth_OpenID_CANCEL. Indicates that the
* user cancelled the OpenID authentication request. This has two
* relevant attributes:
diff --git a/Auth/OpenID/Discover.php b/Auth/OpenID/Discover.php
index cc17f1b..4f21e7a 100644
--- a/Auth/OpenID/Discover.php
+++ b/Auth/OpenID/Discover.php
@@ -157,6 +157,20 @@ class Auth_OpenID_ServiceEndpoint {
return $services;
}
+
+ function copy()
+ {
+ $x = new Auth_OpenID_ServiceEndpoint();
+
+ $x->claimed_id = $this->claimed_id;
+ $x->server_url = $this->server_url;
+ $x->type_uris = $this->type_uris;
+ $x->local_id = $this->local_id;
+ $x->canonicalID = $this->canonicalID;
+ $x->used_yadis = $this->used_yadis;
+
+ return $x;
+ }
}
function Auth_OpenID_findOPLocalIdentifier($service, $type_uris)