summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2007-01-12 22:06:54 +0000
committertailor <cygnus@janrain.com>2007-01-12 22:06:54 +0000
commite7115c7b642f6916939fa5dfce40a16750e5366a (patch)
tree0069803699751f98104aa275c1e7799febe738b1
parent2ebb376aeb9676fba1459d7f33a015de49f2f443 (diff)
downloadphp-openid-e7115c7b642f6916939fa5dfce40a16750e5366a.zip
php-openid-e7115c7b642f6916939fa5dfce40a16750e5366a.tar.gz
php-openid-e7115c7b642f6916939fa5dfce40a16750e5366a.tar.bz2
[project @ _getAssociation takes endpoint instead of server_url]
-rw-r--r--Auth/OpenID/Consumer.php12
-rw-r--r--Tests/Auth/OpenID/Consumer.php6
2 files changed, 11 insertions, 7 deletions
diff --git a/Auth/OpenID/Consumer.php b/Auth/OpenID/Consumer.php
index 9cf86f0..ba3ffc9 100644
--- a/Auth/OpenID/Consumer.php
+++ b/Auth/OpenID/Consumer.php
@@ -521,7 +521,7 @@ class Auth_OpenID_GenericConsumer {
function begin($service_endpoint)
{
- $assoc = $this->_getAssociation($service_endpoint->server_url);
+ $assoc = $this->_getAssociation($service_endpoint);
$r = new Auth_OpenID_AuthRequest($service_endpoint, $assoc);
$r->return_to_args[Auth_OpenID_NONCE_NAME] = Auth_OpenID_mkNonce();
return $r;
@@ -802,18 +802,18 @@ class Auth_OpenID_GenericConsumer {
/**
* @access private
*/
- function _getAssociation($server_url)
+ function _getAssociation($endpoint)
{
if (!$this->_use_assocs) {
return null;
}
- $assoc = $this->store->getAssociation($server_url);
+ $assoc = $this->store->getAssociation($endpoint->server_url);
if (($assoc === null) ||
($assoc->getExpiresIn() <= 0)) {
- $parts = $this->_createAssociateRequest($server_url);
+ $parts = $this->_createAssociateRequest($endpoint->server_url);
if ($parts === null) {
return null;
@@ -821,13 +821,13 @@ class Auth_OpenID_GenericConsumer {
list($assoc_session, $message) = $parts;
- $response = $this->_makeKVPost($message, $server_url);
+ $response = $this->_makeKVPost($message, $endpoint->server_url);
if ($response === null) {
$assoc = null;
} else {
$assoc = $this->_parseAssociation($response, $assoc_session,
- $server_url);
+ $endpoint->server_url);
}
}
diff --git a/Tests/Auth/OpenID/Consumer.php b/Tests/Auth/OpenID/Consumer.php
index 3858d8d..650e6df 100644
--- a/Tests/Auth/OpenID/Consumer.php
+++ b/Tests/Auth/OpenID/Consumer.php
@@ -844,8 +844,12 @@ class Tests_Auth_OpenID_Consumer_TestFetchAssoc extends PHPUnit_TestCase {
"raise E_MOCK_FETCHER_EXCEPTION");
}
+ $endpoint = new Auth_OpenID_ServiceEndpoint();
+ $endpoint->server_url = 'some://url';
+
// exception fetching returns no association
- $this->assertEquals(@$this->consumer->_getAssociation('some://url'), null);
+ $this->assertEquals(@$this->consumer->_getAssociation($endpoint),
+ null);
$query = array('openid.signed' => '');
$message = Auth_OpenID_Message::fromPostArgs($query);