diff options
author | tailor <chowells@janrain.com> | 2008-06-04 22:40:03 +0000 |
---|---|---|
committer | tailor <chowells@janrain.com> | 2008-06-04 22:40:03 +0000 |
commit | fc3b53fbeb56345f519d48dbc0c2751fafc689c7 (patch) | |
tree | 75abaabafa5a16946134dae22a4a246d57849dac /Tests | |
parent | 894fd661d3d1a760cffa719f081f74317388f6e8 (diff) | |
download | php-openid-fc3b53fbeb56345f519d48dbc0c2751fafc689c7.zip php-openid-fc3b53fbeb56345f519d48dbc0c2751fafc689c7.tar.gz php-openid-fc3b53fbeb56345f519d48dbc0c2751fafc689c7.tar.bz2 |
[project @ Port the v2 plaintext encryption test from python]
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Auth/OpenID/Server.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Tests/Auth/OpenID/Server.php b/Tests/Auth/OpenID/Server.php index 6dd9d61..9bf315f 100644 --- a/Tests/Auth/OpenID/Server.php +++ b/Tests/Auth/OpenID/Server.php @@ -1719,6 +1719,49 @@ class Tests_Auth_OpenID_Associate extends PHPUnit_TestCase { "dh_server_public")); } + function test_plaintextV2() + { + // The main difference between this and the v1 test is that + // the session_typ is always returned in v2. + $args = array('openid.mode' => 'associate', + 'openid.ns' => Auth_OpenID_OPENID2_NS, + 'openid.assoc_type' => 'HMAC-SHA1', + 'openid.session_type' => 'no-encryption'); + + $this->request = Auth_OpenID_AssociateRequest::fromMessage( + Auth_OpenID_Message::fromPostArgs($args)); + $this->assertFalse($this->request->message->isOpenID1()); + + $this->assoc = $this->signatory->createAssociation(false, + 'HMAC-SHA1'); + $response = $this->request->answer($this->assoc); + + $this->assertEquals( + $response->fields->getArg(Auth_OpenID_OPENID_NS, "assoc_type"), + "HMAC-SHA1"); + + $this->assertEquals( + $response->fields->getArg(Auth_OpenID_OPENID_NS, "assoc_handle"), + $this->assoc->handle); + + $this->assertEquals( + $response->fields->getArg(Auth_OpenID_OPENID_NS, "expires_in"), + sprintf("%d", $this->signatory->SECRET_LIFETIME)); + + $this->assertEquals( + $response->fields->getArg(Auth_OpenID_OPENID_NS, "mac_key"), + base64_encode($this->assoc->secret)); + + $session_type = $response->fields->getArg(Auth_OpenID_OPENID_NS, + "session_type"); + $this->assertEquals('no-encryption', $session_type); + + $this->assertFalse($response->fields->getArg(Auth_OpenID_OPENID_NS, + "enc_mac_key")); + $this->assertFalse($response->fields->getArg(Auth_OpenID_OPENID_NS, + "dh_server_public")); + } + function test_protoError() { $s1_session = new Auth_OpenID_DiffieHellmanSHA1ConsumerSession(); |