You are here

public function LdapSsoBrowserTest::testSeamless in LDAP Single Sign On 8.4

Test authentication on all valid paths via <front>.

Note that this test cannot accurately guarantee the correct behavior of the seamless login. To be definitively correct the webserver would need to contain the REMOTE_USER variable only on /user/login/sso (the most common mixed configuration). The test module ldap_sso_dummy_ldap does so at the application level and a restart of the web request in the application would give a different result than an actual request. Therefore the redirect with cookie is still used, even though it has been a source of errors and loops in the past.

@todo This test should additionally test redirect loops prevented by the stop_sso cookie.

File

tests/src/Functional/LdapSsoBrowserTest.php, line 165

Class

LdapSsoBrowserTest
Test redirection behaviour with SSO enabled.

Namespace

Drupal\Tests\ldap_sso\Functional

Code

public function testSeamless() : void {
  $url = $this
    ->buildUrl(Url::fromRoute('<front>'), [
    'absolute' => TRUE,
  ]);
  $this
    ->drupalGet($url);
  self::assertStringContainsString('You have been successfully authenticated', $this
    ->getSession()
    ->getPage()
    ->getContent());

  // @todo Consider improving redirect from "node/1" to "/".
  $destination = $this
    ->config('system.site')
    ->get('page.front');
  self::assertStringContainsString($destination, $this
    ->getSession()
    ->getCurrentUrl());
  self::assertEquals(200, $this
    ->getSession()
    ->getStatusCode());
}