function OpenIDFunctionalTest::addRedirectedIdentity

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 OpenIDFunctionalTest::addRedirectedIdentity()
OpenIDFunctionalTest::testDiscovery in drupal/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.php
Test discovery of OpenID Provider Endpoint via Yadis and HTML.

File

drupal/core/modules/openid/lib/Drupal/openid/Tests/OpenIDFunctionalTest.php, line 340
Definition of Drupal\openid\Tests\OpenIDFunctionalTest.

Class

OpenIDFunctionalTest
Test discovery and login using OpenID

Namespace

Drupal\openid\Tests

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).
  state()
    ->set('openid_test.redirect_url', $identity);
  state()
    ->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.
  state()
    ->delete('openid_test.redirect_url');
  state()
    ->delete('openid_test.response');
}