You are here

protected function LdapSsoBootSubscriber::transferSsoLoginController in LDAP Single Sign On 8.4

Same name and namespace in other branches
  1. 8 src/LdapSsoBootSubscriber.php \Drupal\ldap_sso\LdapSsoBootSubscriber::transferSsoLoginController()

Continue booting assuming we are doing SSO.

1 call to LdapSsoBootSubscriber::transferSsoLoginController()
LdapSsoBootSubscriber::checkSsoLoad in src/LdapSsoBootSubscriber.php
Determine if we should attempt SSO.

File

src/LdapSsoBootSubscriber.php, line 166

Class

LdapSsoBootSubscriber
Provides the automated single sign-on provider.

Namespace

Drupal\ldap_sso

Code

protected function transferSsoLoginController() : void {

  // This is set to destination() since the request uri is usually
  // system/40x already.
  $original_path = $this->redirectDestination
    ->get();
  $pathWithDestination = Url::fromRoute('ldap_sso.login_controller')
    ->toString() . '?destination=' . $original_path;
  if (method_exists(Cookie::class, 'create')) {
    $cookie = Cookie::create('sso_login_running', 'true', 0, base_path());
  }
  else {

    // Compatibility support for Drupal 8.9.
    $cookie = new Cookie('sso_login_running', 'true', 0, base_path());
  }
  $response = new RedirectResponseWithCookie($pathWithDestination, 302, [
    $cookie,
  ]);
  $response
    ->send();
}