You are here

public function LoginValidatorLoginForm::validateCredentialsLoggedIn in Lightweight Directory Access Protocol (LDAP) 8.4

Check credentials on an signed-in user from the account.

This helper function is intended for the user edit form to allow the constraint validator to check against LDAP for the current password.

Parameters

\Drupal\user\UserInterface $account: User account.

Return value

int Authentication status.

File

ldap_authentication/src/Controller/LoginValidatorLoginForm.php, line 199

Class

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

Namespace

Drupal\ldap_authentication\Controller

Code

public function validateCredentialsLoggedIn(UserInterface $account) : int {
  $this->drupalUser = $account;
  $data = $this->externalAuth
    ->getAuthData($account
    ->id(), 'ldap_user');
  if (!empty($data) && $data['authname']) {
    $this->authName = $data['authname'];
    $this->drupalUserAuthMapped = TRUE;
  }
  $this->detailLog
    ->log('%auth_name : Testing existing credentials authentication', [
    '%auth_name' => $this->authName,
  ], 'ldap_authentication');
  return $this
    ->testCredentials();
}