function OpenIDTestCase::testOpenidSignature
Test _openid_signature().
File
-
modules/
openid/ openid.test, line 700
Class
- OpenIDTestCase
- Test internal helper functions.
Code
function testOpenidSignature() {
// Test that signature is calculated according to OpenID Authentication 2.0,
// section 6.1. In the following array, only the two first entries should be
// included in the calculation, because the substring following the period
// is mentioned in the third argument for _openid_signature(). The last
// entry should not be included, because it does not start with "openid.".
$response = array(
'openid.foo' => 'abc1',
'openid.bar' => 'abc2',
'openid.baz' => 'abc3',
'foobar.foo' => 'abc4',
);
$association = new stdClass();
$association->mac_key = "1234567890abcdefghij\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9";
$this->assertEqual(_openid_signature($association, $response, array(
'foo',
'bar',
)), 'QnKZQzSFstT+GNiJDFOptdcZjrc=', 'Expected signature calculated.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.