summaryrefslogtreecommitdiff
path: root/modules/openid
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2011-05-18 00:31:07 -0500
committerwebchick <webchick@24967.no-reply.drupal.org>2011-05-18 00:31:07 -0500
commitff3bf28a038edd72b7d67bd9f6476c369e49140e (patch)
treebf3137183fbf81c036b8483df84d978962400e9b /modules/openid
parent75a0deb2722bde4fc7d60d02f186809fbc77320d (diff)
downloadbrdo-ff3bf28a038edd72b7d67bd9f6476c369e49140e.tar.gz
brdo-ff3bf28a038edd72b7d67bd9f6476c369e49140e.tar.bz2
Rollback of #1076366. This is not quite ready to go yet, because it depends on another issue (#1120290).
Diffstat (limited to 'modules/openid')
-rw-r--r--modules/openid/openid.module10
-rw-r--r--modules/openid/openid.test12
2 files changed, 9 insertions, 13 deletions
diff --git a/modules/openid/openid.module b/modules/openid/openid.module
index 6d4b1d7ff..7673de886 100644
--- a/modules/openid/openid.module
+++ b/modules/openid/openid.module
@@ -341,18 +341,14 @@ function openid_complete($response = array()) {
$response['openid.claimed_id'] = $service['claimed_id'];
}
elseif ($service['version'] == 2) {
- // Returned Claimed Identifier could contain unique fragment
- // identifier to allow identifier recycling so we need to preserve
- // it in the response.
- $response_claimed_id = openid_normalize($response['openid.claimed_id']);
-
+ $response['openid.claimed_id'] = openid_normalize($response['openid.claimed_id']);
// OpenID Authentication, section 11.2:
// If the returned Claimed Identifier is different from the one sent
// to the OpenID Provider, we need to do discovery on the returned
// identififer to make sure that the provider is authorized to
// respond on behalf of this.
- if ($response_claimed_id != $claimed_id) {
- $services = openid_discovery($response_claimed_id);
+ if ($response['openid.claimed_id'] != $claimed_id) {
+ $services = openid_discovery($response['openid.claimed_id']);
$uris = array();
foreach ($services as $discovered_service) {
if (in_array('http://specs.openid.net/auth/2.0/server', $discovered_service['types']) || in_array('http://specs.openid.net/auth/2.0/signon', $discovered_service['types'])) {
diff --git a/modules/openid/openid.test b/modules/openid/openid.test
index 09632ba14..202a8355e 100644
--- a/modules/openid/openid.test
+++ b/modules/openid/openid.test
@@ -89,12 +89,12 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
// Identifier is the URL of an XRDS document containing an OP Identifier
// Element. The Relying Party sends the special value
// "http://specs.openid.net/auth/2.0/identifier_select" as Claimed
- // Identifier. The OpenID Provider responds with the actual identifier
- // including the fragment.
- $identity = url('openid-test/yadis/xrds/dummy-user', array('absolute' => TRUE, 'fragment' => $this->randomName()));
- // Tell openid_test.module to respond with this identifier. We test if
- // openid_complete() processes it right.
- variable_set('openid_test_response', array('openid.claimed_id' => $identity));
+ // Identifier. The OpenID Provider responds with the actual identifier.
+ $identity = url('openid-test/yadis/xrds/dummy-user', array('absolute' => TRUE));
+ // Tell openid_test.module to respond with this identifier. The URL scheme
+ // is stripped in order to test that the returned identifier is normalized in
+ // openid_complete().
+ variable_set('openid_test_response', array('openid.claimed_id' => preg_replace('@^https?://@', '', $identity)));
$this->addIdentity(url('openid-test/yadis/xrds/server', array('absolute' => TRUE)), 2, 'http://specs.openid.net/auth/2.0/identifier_select', $identity);
variable_set('openid_test_response', array());