You are here

private function LoginValidator::failureResponse in Lightweight Directory Access Protocol (LDAP) 8.3

Failure response.

Parameters

int $authenticationResult: The error code.

1 call to LoginValidator::failureResponse()
LoginValidator::testCredentials in ldap_authentication/src/Controller/LoginValidator.php
Credentials are tested.

File

ldap_authentication/src/Controller/LoginValidator.php, line 537

Class

LoginValidator
Handles the actual testing of credentials and authentication of users.

Namespace

Drupal\ldap_authentication\Controller

Code

private function failureResponse($authenticationResult) {

  // Fail scenario 1. LDAP auth exclusive and failed  throw error so no other
  // authentication methods are allowed.
  if ($this->config
    ->get('authenticationMode') == LdapAuthenticationConfiguration::MODE_EXCLUSIVE) {
    $this->detailLog
      ->log('%username: Error raised because failure at LDAP and exclusive authentication is set to true.', [
      '%username' => $this->authName,
    ], 'ldap_authentication');
    drupal_set_message($this
      ->t('Error: %err_text', [
      '%err_text' => $this
        ->authenticationHelpText($authenticationResult),
    ]), "error");
  }
  else {

    // Fail scenario 2.  Simply fails LDAP. Return false, but don't throw form
    // error don't show user message, may be using other authentication after
    // this that may succeed.
    $this->detailLog
      ->log('%username: Failed LDAP authentication. User may have authenticated successfully by other means in a mixed authentication site.', [
      '%username' => $this->authName,
    ], 'ldap_authentication');
  }
}