You are here

protected function SimplesamlphpAuthManager::getSimpleSamlInstance in simpleSAMLphp Authentication 8.3

Returns a SimpleSAML Simple class instance.

Return value

\SimpleSAML\Auth\Simple|null The SimpleSAML Simple instance.

3 calls to SimplesamlphpAuthManager::getSimpleSamlInstance()
SimplesamlphpAuthManager::externalAuthenticate in src/Service/SimplesamlphpAuthManager.php
Forwards the user to the IdP for authentication.
SimplesamlphpAuthManager::isAuthenticated in src/Service/SimplesamlphpAuthManager.php
Check whether user is authenticated by the IdP.
SimplesamlphpAuthManager::logout in src/Service/SimplesamlphpAuthManager.php
Log a user out through the SimpleSAMLphp instance.

File

src/Service/SimplesamlphpAuthManager.php, line 140

Class

SimplesamlphpAuthManager
Service to interact with the SimpleSAMLPHP authentication library.

Namespace

Drupal\simplesamlphp_auth\Service

Code

protected function getSimpleSamlInstance() {
  if (!empty($this->instance)) {
    return $this->instance;
  }
  else {
    $this
      ->checkLibrary();
    $auth_source = $this->config
      ->get('auth_source');
    try {
      $this->instance = new Simple($auth_source);
      return $this->instance;
    } catch (CriticalConfigurationError $e) {
      if ($this->currentUser
        ->hasPermission('administer simplesamlphp authentication') && $this->adminContext
        ->isAdminRoute()) {
        $this->messenger
          ->addError($this
          ->t('There is a Simplesamlphp configuration problem. @message', [
          '@message' => $e
            ->getMessage(),
        ]), 'error');
      }
      return NULL;
    }
  }
}