You are here

public function LoginHandler::__construct in Shibboleth Authentication 8

LoginHandler constructor.

Parameters

\Drupal\Core\Database\Connection $db:

\Drupal\Core\Config\ImmutableConfig $config:

\Drupal\Core\Config\ImmutableConfig $adv_config:

\Drupal\Core\Entity\EntityTypeManagerInterface $etm:

\Drupal\shib_auth\Login\ShibSessionVars $shib_session:

\Psr\Log\LoggerInterface $shib_logger:

\Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory:

\Drupal\Core\Session\SessionManagerInterface $session_manager:

\Drupal\Core\Session\AccountInterface $current_user:

\Drupal\Core\Messenger\MessengerInterface $messenger:

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

src/Login/LoginHandler.php, line 112

Class

LoginHandler
Class LoginHandler.

Namespace

Drupal\shib_auth\Login

Code

public function __construct(Connection $db, ImmutableConfig $config, ImmutableConfig $adv_config, EntityTypeManagerInterface $etm, ShibSessionVars $shib_session, LoggerInterface $shib_logger, PrivateTempStoreFactory $temp_store_factory, SessionManagerInterface $session_manager, AccountInterface $current_user, MessengerInterface $messenger) {
  $this->db = $db;
  $this->config = $config;
  $this->adv_config = $adv_config;
  $this->user_store = $etm
    ->getStorage('user');
  $this->shib_session = $shib_session;
  $this->shib_logger = $shib_logger;
  $this->temp_store_factory = $temp_store_factory;
  $this->session_manager = $session_manager;
  $this->current_user = $current_user;
  $this->messenger = $messenger;
  $this->custom_data_store = $this->temp_store_factory
    ->get('shib_auth');

  // Start Session if it does not exist yet.
  if ($this->current_user
    ->isAnonymous() && !isset($_SESSION['session_started'])) {
    $_SESSION['session_started'] = TRUE;
    $this->session_manager
      ->start();
  }
}