summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2007-10-16 20:23:41 +0000
committertailor <cygnus@janrain.com>2007-10-16 20:23:41 +0000
commit79412ee83d8b68f624208a217b1d2405dae26858 (patch)
treede9e9c3787b60a7ab7d071f6899bc826eeea5039
parent38991f018e16226d1e6dd63e7986465770e42e1f (diff)
downloadphp-openid-79412ee83d8b68f624208a217b1d2405dae26858.zip
php-openid-79412ee83d8b68f624208a217b1d2405dae26858.tar.gz
php-openid-79412ee83d8b68f624208a217b1d2405dae26858.tar.bz2
[project @ Ensure that an update_url in a FetchRequest is included in a FetchResponse]
-rw-r--r--Auth/OpenID/AX.php11
-rw-r--r--Tests/Auth/OpenID/AX.php15
2 files changed, 24 insertions, 2 deletions
diff --git a/Auth/OpenID/AX.php b/Auth/OpenID/AX.php
index dfc0a3c..7473b96 100644
--- a/Auth/OpenID/AX.php
+++ b/Auth/OpenID/AX.php
@@ -796,8 +796,15 @@ class Auth_OpenID_AX_FetchResponse extends Auth_OpenID_AX_KeyValueMessage {
// unique to the fetch_response
$ax_args = $this->_newArgs();
- if ($this->update_url) {
- $ax_args['update_url'] = $this->update_url;
+ $update_url = null;
+ if ($request) {
+ $update_url = $request->update_url;
+ } else {
+ $update_url = $this->update_url;
+ }
+
+ if ($update_url) {
+ $ax_args['update_url'] = $update_url;
}
Auth_OpenID::update(&$ax_args, $kv_args);
diff --git a/Tests/Auth/OpenID/AX.php b/Tests/Auth/OpenID/AX.php
index 0e94dd9..e3c353e 100644
--- a/Tests/Auth/OpenID/AX.php
+++ b/Tests/Auth/OpenID/AX.php
@@ -458,6 +458,7 @@ class FetchResponseTest extends PHPUnit_TestCase {
$this->value_a = 'monkeys';
$this->type_a = 'http://phone.home/';
$this->alias_a = 'robocop';
+ $this->request_update_url = 'http://update.bogus/';
}
function test_construct()
@@ -494,6 +495,20 @@ class FetchResponseTest extends PHPUnit_TestCase {
$this->assertEquals($expected_args, $this->msg->getExtensionArgs($req));
}
+ function test_updateUrlInResponse()
+ {
+ $uri = 'http://not.found/';
+ $alias = 'ext0';
+
+ $expected_args = array(
+ 'mode' => 'fetch_response',
+ 'update_url' => $this->request_update_url,
+ );
+ $req = new Auth_OpenID_AX_FetchRequest($this->request_update_url);
+ $req->add(Auth_OpenID_AX_AttrInfo::make($uri));
+ $this->assertEquals($expected_args, $this->msg->getExtensionArgs($req));
+ }
+
function test_getExtensionArgs_some_request()
{
$expected_args = array(