You are here

function OpenIDFunctionalTestCase::addRedirectedIdentity in Drupal 7

Add OpenID identity, changed by the following redirects, to user's profile.

According to OpenID Authentication 2.0, section 7.2.4, URL Identifiers MUST be further normalized by following redirects when retrieving their content and this final URL MUST be noted by the Relying Party as the Claimed Identifier and be used when requesting authentication.

Parameters

$identity: The User-supplied Identifier.

$version: The protocol version used by the service.

$local_id: The expected OP-Local Identifier found during discovery.

$claimed_id: The expected Claimed Identifier returned by the OpenID Provider, or FALSE if the discovery is expected to fail.

$redirects: The number of redirects.

1 call to OpenIDFunctionalTestCase::addRedirectedIdentity()
OpenIDFunctionalTestCase::testDiscovery in modules/openid/openid.test
Test discovery of OpenID Provider Endpoint via Yadis and HTML.

File

modules/openid/openid.test, line 333
Tests for openid.module.

Class

OpenIDFunctionalTestCase
Test discovery and login using OpenID

Code

function addRedirectedIdentity($identity, $version = 2, $local_id = 'http://example.com/xrds', $claimed_id = NULL, $redirects = 0) {

  // Set the final destination URL which is the same as the Claimed
  // Identifier, we insert the same identifier also to the provider response,
  // but provider could further change the Claimed ID actually (e.g. it could
  // add unique fragment).
  variable_set('openid_test_redirect_url', $identity);
  variable_set('openid_test_response', array(
    'openid.claimed_id' => $identity,
  ));
  $this
    ->addIdentity(url('openid-test/redirect/' . $redirects, array(
    'absolute' => TRUE,
  )), $version, $local_id, $claimed_id);

  // Clean up.
  variable_del('openid_test_redirect_url');
  variable_del('openid_test_response');
}