You are here

class CredentialsStorage in Lightweight Directory Access Protocol (LDAP) 8.3

Same name and namespace in other branches
  1. 8.4 ldap_servers/src/Helper/CredentialsStorage.php \Drupal\ldap_servers\Helper\CredentialsStorage

Temporarily stores credentials from user input.

This temporary storage is required so that LDAP can work with them in the clear indepedent of the login form process and to avoid passend them around dozens of functions.

Hierarchy

Expanded class hierarchy of CredentialsStorage

6 files declare their use of CredentialsStorage
CredentialsStorageTests.php in ldap_servers/tests/src/Unit/CredentialsStorageTests.php
ldap_user.module in ldap_user/ldap_user.module
Module for the LDAP User Entity.
LoginValidator.php in ldap_authentication/src/Controller/LoginValidator.php
Server.php in ldap_servers/src/Entity/Server.php
ServerTestForm.php in ldap_servers/src/Form/ServerTestForm.php

... See full list

File

ldap_servers/src/Helper/CredentialsStorage.php, line 12

Namespace

Drupal\ldap_servers\Helper
View source
class CredentialsStorage {
  private static $userDn = NULL;
  private static $userPassword = NULL;
  private static $validate = FALSE;

  /**
   * Stores the user DN as provided by other LDAP modules.
   *
   * @param string $userDn
   *   DN to store.
   */
  public static function storeUserDn($userDn) {
    self::$userDn = $userDn;
  }

  /**
   * Stores the password from user input.
   *
   * @param string $password
   *   Password to store.
   */
  public static function storeUserPassword($password) {
    self::$userPassword = $password;
  }

  /**
   * Turn testing of user credentials on or off.
   *
   * @param bool $validate
   *   Defaults to false.
   */
  public static function testCredentials($validate) {
    self::$validate = $validate;
  }

  /**
   * Return the temporarily saved user DN.
   *
   * @return null|string
   *   Login name.
   */
  public static function getUserDn() {
    return self::$userDn;
  }

  /**
   * Return the temporarily saved user password.
   *
   * @return null|string
   *   Login password.
   */
  public static function getPassword() {
    return self::$userPassword;
  }

  /**
   * Whether the bind function will use these credentials.
   *
   * @return bool
   *   Defaults to false.
   */
  public static function validateCredentials() {
    return self::$validate;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CredentialsStorage::$userDn private static property
CredentialsStorage::$userPassword private static property
CredentialsStorage::$validate private static property
CredentialsStorage::getPassword public static function Return the temporarily saved user password.
CredentialsStorage::getUserDn public static function Return the temporarily saved user DN.
CredentialsStorage::storeUserDn public static function Stores the user DN as provided by other LDAP modules.
CredentialsStorage::storeUserPassword public static function Stores the password from user input.
CredentialsStorage::testCredentials public static function Turn testing of user credentials on or off.
CredentialsStorage::validateCredentials public static function Whether the bind function will use these credentials.