function OpenIDTest::testOpenidSignature

Test _openid_signature().

File

drupal/core/modules/openid/lib/Drupal/openid/Tests/OpenIDTest.php, line 66
Definition of Drupal\openid\Tests\OpenIDTest.

Class

OpenIDTest
Test internal helper functions.

Namespace

Drupal\openid\Tests

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 = "";
  $this
    ->assertEqual(_openid_signature($association, $response, array(
    'foo',
    'bar',
  )), 'QnKZQzSFstT+GNiJDFOptdcZjrc=', 'Expected signature calculated.');
}