You are here

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

Same name and namespace in other branches
  1. 8.4 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 74

Class

LdapSsoBootSubscriber
Provides the automated single sign-on provider.

Namespace

Drupal\ldap_sso

Code

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