You are here

public function LdapSsoBootSubscriber::checkSsoLoad in LDAP Single Sign On 8.4

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

Determine if we should attempt SSO.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseEvent $event: Event to act upon.

File

src/LdapSsoBootSubscriber.php, line 125

Class

LdapSsoBootSubscriber
Provides the automated single sign-on provider.

Namespace

Drupal\ldap_sso

Code

public function checkSsoLoad(GetResponseEvent $event) : void {
  if (PHP_SAPI === 'cli' || $this->account
    ->isAuthenticated()) {
    $this->detailLog
      ->log('CLI or logged in user, no SSO.', [], 'ldap_sso');
    return;
  }
  if (!$this->config
    ->get('seamlessLogin')) {
    $this->detailLog
      ->log('Automated SSO not active.', [], 'ldap_sso');
    return;
  }
  if ($this
    ->checkExcludePath()) {
    $this->detailLog
      ->log('Excluded path', [], 'ldap_sso');
    return;
  }
  if ($this->currentRequest->cookies
    ->get('sso_login_running', FALSE)) {
    $this->detailLog
      ->log('SSO login running cookie present, aborting.', [], 'ldap_sso');
    exit(0);
  }
  if ($this->currentRequest->cookies
    ->get('sso_stop', FALSE)) {
    $this->detailLog
      ->log('Anonymous user with cookie to not continue SSO login', [], 'ldap_sso');
    return;
  }
  $this->detailLog
    ->log('Transferring to login controller', [], 'ldap_sso');
  $this
    ->transferSsoLoginController();
  exit(0);
}