You are here

private function LoginController::validateUser in LDAP Single Sign On 8.4

Same name and namespace in other branches
  1. 8 src/Controller/LoginController.php \Drupal\ldap_sso\Controller\LoginController::validateUser()

Validate an unvalidated user.

Parameters

string $remote_user: Remote user name.

Return value

\Drupal\user\Entity\User|false Returns the user if available or FALSE when the authentication is not successful.

1 call to LoginController::validateUser()
LoginController::loginRemoteUser in src/Controller/LoginController.php
Perform the actual logging in of the user.

File

src/Controller/LoginController.php, line 248

Class

LoginController
Login controller.

Namespace

Drupal\ldap_sso\Controller

Code

private function validateUser(string $remote_user) {
  $this->detailLog
    ->log('Starting validation for SSO user.', [], 'ldap_sso');
  $this->validator
    ->setAuthname(Html::escape($remote_user));
  $this->validator
    ->processLogin();
  if ($this->validator
    ->getDrupalUser()) {
    $this->detailLog
      ->log('Remote user has local uid @uid', [
      '@uid' => $this->validator
        ->getDrupalUser()
        ->id(),
    ], 'ldap_sso');
    return $this->validator
      ->getDrupalUser();
  }
  $this->detailLog
    ->log('Remote user is not valid.', [], 'ldap_sso');
  return FALSE;
}