protected function LoginValidatorBase::failureResponse in Lightweight Directory Access Protocol (LDAP) 8.4
Failure response.
Parameters
int $authenticationResult: The error code.
1 call to LoginValidatorBase::failureResponse()
- LoginValidatorLoginForm::testCredentials in ldap_authentication/
src/ Controller/ LoginValidatorLoginForm.php - Credentials are tested.
File
- ldap_authentication/
src/ Controller/ LoginValidatorBase.php, line 438
Class
- LoginValidatorBase
- Handles the actual testing of credentials and authentication of users.
Namespace
Drupal\ldap_authentication\ControllerCode
protected function failureResponse(int $authenticationResult) : void {
// Fail scenario 1. LDAP auth exclusive and failed throw error so no other
// authentication methods are allowed.
if ($this->config
->get('authenticationMode') === 'exclusive') {
$this->detailLog
->log('%username: Error raised because failure at LDAP and exclusive authentication is set to true.', [
'%username' => $this->authName,
], 'ldap_authentication');
$this->messenger
->addError($this
->t('Error: %err_text', [
'%err_text' => $this
->authenticationHelpText($authenticationResult),
]));
}
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');
}
}