protected function LoginValidatorBase::testUserPassword in Lightweight Directory Access Protocol (LDAP) 8.4
Tests the user's password.
Return value
bool Valid login.
1 call to LoginValidatorBase::testUserPassword()
- LoginValidatorLoginForm::testCredentials in ldap_authentication/
src/ Controller/ LoginValidatorLoginForm.php - Credentials are tested.
File
- ldap_authentication/
src/ Controller/ LoginValidatorBase.php, line 375
Class
- LoginValidatorBase
- Handles the actual testing of credentials and authentication of users.
Namespace
Drupal\ldap_authentication\ControllerCode
protected function testUserPassword() : bool {
$loginValid = FALSE;
if ($this->serverDrupalUser
->get('bind_method') === 'user') {
$loginValid = TRUE;
}
else {
$this->ldapBridge
->setServer($this->serverDrupalUser);
// @todo Verify value in userPW, document!
CredentialsStorage::storeUserDn($this->ldapEntry
->getDn());
CredentialsStorage::testCredentials(TRUE);
$bindResult = $this->ldapBridge
->bind();
CredentialsStorage::testCredentials(FALSE);
if ($bindResult) {
$loginValid = TRUE;
}
else {
$this->detailLog
->log('%username: Error testing user credentials on server %id with %bind_method.', [
'%username' => $this->authName,
'%bind_method' => $this->serverDrupalUser
->getFormattedBind(),
'%id' => $this->serverDrupalUser
->id(),
], 'ldap_authentication');
}
}
return $loginValid;
}