You are here

class SimplesamlphpAuthTestManager in simpleSAMLphp Authentication 8.3

Mock SimplesamlphpAuthManager class for testing purposes.

Hierarchy

Expanded class hierarchy of SimplesamlphpAuthTestManager

File

tests/simplesamlphp_auth_test/src/SimplesamlphpAuthTestManager.php, line 10

Namespace

Drupal\simplesamlphp_auth_test
View source
class SimplesamlphpAuthTestManager extends SimplesamlphpAuthManager {

  /**
   * Keeps track of whether the user is authenticated.
   *
   * @var bool
   */
  protected $authenticated = FALSE;

  /**
   * {@inheritdoc}
   */
  public function externalAuthenticate() {
    $this->authenticated = TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function getStorage() {
    return 'sql';
  }

  /**
   * {@inheritdoc}
   */
  public function isAuthenticated() {
    return $this->authenticated;
  }

  /**
   * {@inheritdoc}
   */
  public function getAttributes() {
    return [
      'uid' => [
        0 => 'saml_user',
      ],
      'displayName' => [
        0 => 'Test Saml User',
      ],
      'mail' => [
        0 => 'saml@example.com',
      ],
      'roles' => [
        0 => [
          'employee',
          'test_role',
        ],
      ],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function logout($redirect_path = NULL) {
    $this->authenticated = FALSE;
    return FALSE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SimplesamlphpAuthManager::$adminContext protected property The route admin context to determine whether a route is an admin one.
SimplesamlphpAuthManager::$attributes protected property Attributes for federated user.
SimplesamlphpAuthManager::$config protected property A configuration object.
SimplesamlphpAuthManager::$currentUser protected property The current user.
SimplesamlphpAuthManager::$instance protected property A SimpleSAML instance.
SimplesamlphpAuthManager::$messenger protected property The messenger.
SimplesamlphpAuthManager::$moduleHandler protected property The module handler service.
SimplesamlphpAuthManager::$requestStack protected property The request stack.
SimplesamlphpAuthManager::$simplesamlConfig protected property A SimpleSAML configuration instance.
SimplesamlphpAuthManager::allowUserByAttribute public function Asks all modules if current federated user is allowed to login.
SimplesamlphpAuthManager::checkLibrary protected function Check if the SimpleSAMLphp library can be found.
SimplesamlphpAuthManager::getAttribute public function Get a specific SimpleSAML attribute.
SimplesamlphpAuthManager::getAuthname public function Gets the unique id of the user from the IdP.
SimplesamlphpAuthManager::getDefaultEmail public function Gets the mail attribute.
SimplesamlphpAuthManager::getDefaultName public function Gets the name attribute.
SimplesamlphpAuthManager::getSimpleSamlConfiguration protected function Returns a SimpleSAML configuration instance.
SimplesamlphpAuthManager::getSimpleSamlInstance protected function Returns a SimpleSAML Simple class instance.
SimplesamlphpAuthManager::isActivated public function Checks if SimpleSAMLphp_auth is enabled.
SimplesamlphpAuthManager::__construct public function Constructor for SimplesamlphpAuthManager.
SimplesamlphpAuthTestManager::$authenticated protected property Keeps track of whether the user is authenticated.
SimplesamlphpAuthTestManager::externalAuthenticate public function Forwards the user to the IdP for authentication. Overrides SimplesamlphpAuthManager::externalAuthenticate
SimplesamlphpAuthTestManager::getAttributes public function Gets all SimpleSAML attributes. Overrides SimplesamlphpAuthManager::getAttributes
SimplesamlphpAuthTestManager::getStorage public function Get SimpleSAMLphp storage type. Overrides SimplesamlphpAuthManager::getStorage
SimplesamlphpAuthTestManager::isAuthenticated public function Check whether user is authenticated by the IdP. Overrides SimplesamlphpAuthManager::isAuthenticated
SimplesamlphpAuthTestManager::logout public function Log a user out through the SimpleSAMLphp instance. Overrides SimplesamlphpAuthManager::logout
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.