summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2006-01-13 21:51:26 +0000
committertailor <cygnus@janrain.com>2006-01-13 21:51:26 +0000
commit9f50b7803eb8292628d0fca287076b072bf13c1e (patch)
treea524c74d7badfe220042ba624c9178aebf1be267
parent20c18d8e48e3a93f94865279255b9c64fc61ccce (diff)
downloadphp-openid-9f50b7803eb8292628d0fca287076b072bf13c1e.zip
php-openid-9f50b7803eb8292628d0fca287076b072bf13c1e.tar.gz
php-openid-9f50b7803eb8292628d0fca287076b072bf13c1e.tar.bz2
[project @ Updated consumer to un-mangle PHP CGI data]
-rw-r--r--Net/OpenID/Consumer/Consumer.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/Net/OpenID/Consumer/Consumer.php b/Net/OpenID/Consumer/Consumer.php
index 0fbe335..616b330 100644
--- a/Net/OpenID/Consumer/Consumer.php
+++ b/Net/OpenID/Consumer/Consumer.php
@@ -59,7 +59,7 @@ class Net_OpenID_Consumer {
$this->store =& $store;
if ($fetcher === null) {
- $this->fetcher = _getHTTPFetcher();
+ $this->fetcher = Net_OpenID_getHTTPFetcher();
} else {
$this->fetcher =& $fetcher;
}
@@ -92,14 +92,39 @@ class Net_OpenID_Consumer {
$replace = 1);
// Because _getAssociation is asynchronous if the association is
// not already in the store.
+
+ if ($assoc === null) {
+ trigger_error("Could not get association for redirection",
+ E_USER_WARNING);
+ return null;
+ }
+
return $this->_constructRedirect($assoc, $auth_request,
$return_to, $trust_root);
}
+ function fixResponse($arr)
+ {
+ // Depending on PHP settings, the query data received may have
+ // been modified so that incoming "." values in the keys have
+ // been replaced with underscores. Look specifically for
+ // "openid_" and replace it with "openid.".
+ $result = array();
+
+ foreach ($arr as $key => $value) {
+ $new_key = str_replace("openid_", "openid.", $key);
+ $result[$new_key] = $value;
+ }
+
+ return $result;
+ }
+
function completeAuth($token, $query)
{
global $Net_OpenID_SUCCESS, $Net_OpenID_FAILURE;
+ $query = $this->fixResponse($query);
+
$mode = Net_OpenID_array_get($query, 'openid.mode', '');
if ($mode == 'cancel') {