summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Auth/OpenID/Server.php6
-rw-r--r--Tests/Auth/OpenID/Server.php17
2 files changed, 20 insertions, 3 deletions
diff --git a/Auth/OpenID/Server.php b/Auth/OpenID/Server.php
index 82e15d7..4848b8c 100644
--- a/Auth/OpenID/Server.php
+++ b/Auth/OpenID/Server.php
@@ -280,14 +280,14 @@ class Auth_OpenID_Server {
$to_verify = $args;
$to_verify['openid.mode'] = 'id_res';
$fields = explode(',', trim($signed));
- $tv_sig = $assoc->signDict($signed_fields, $to_verify);
+ $tv_sig = $assoc->signDict($fields, $to_verify);
if ($tv_sig == $sig) {
$normal_key = $this->_normal_key;
- $store->removeAssociation($normal_key, $assoc_handle);
+ $store->removeAssociation($normal_key, $assoc->handle);
$reply['is_valid'] = 'true';
- $inv_handle = $args['openid.invalidate_handle'];
+ $inv_handle = @$args['openid.invalidate_handle'];
if (isset($inv_handle)) {
$assoc = $store->getAssociation($normal_key, $inv_handle);
if ($assoc !== null) {
diff --git a/Tests/Auth/OpenID/Server.php b/Tests/Auth/OpenID/Server.php
index 8c2da24..26dfb82 100644
--- a/Tests/Auth/OpenID/Server.php
+++ b/Tests/Auth/OpenID/Server.php
@@ -254,4 +254,21 @@ class Tests_Auth_OpenID_Server extends PHPUnit_TestCase {
$this->assertEquals($this->rt_url, $base);
$this->assertEquals('cancel', $query['openid.mode']);
}
+
+ function _setupCheckAuth()
+ {
+ $ret = $this->_startAuth('checkid_immediate', true);
+ list($base, $query) = $this->_parseRedirResp($ret);
+ $this->assertEquals($base, $this->rt_url);
+ $query['openid.mode'] = 'check_authentication';
+ return $query;
+ }
+
+ function test_checkAuthentication()
+ {
+ $args = $this->_setupCheckAuth();
+ list($status, $info) = $this->server->checkAuthentication($args);
+ $this->assertEquals(Auth_OpenID_REMOTE_OK, $status);
+ $this->assertEquals($info, "is_valid:true\n");
+ }
}