You are here

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

Connect to server.

Return value

bool Connection successful.

2 calls to LoginValidator::connectToServer()
LoginValidator::testCredentials in ldap_authentication/src/Controller/LoginValidator.php
Credentials are tested.
LoginValidator::testSsoCredentials in ldap_authentication/src/Controller/LoginValidator.php
Test the SSO credentials.

File

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

Class

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

Namespace

Drupal\ldap_authentication\Controller

Code

private function connectToServer() {
  $result = $this->serverDrupalUser
    ->connect();
  if ($result != Server::LDAP_SUCCESS) {

    // self::AUTHENTICATION_FAILURE_CONNECTION.
    $this->detailLog
      ->log('%username: Failed connecting to %id.', [
      '%username' => $this->authName,
      '%id' => $this->serverDrupalUser
        ->id(),
    ], 'ldap_authentication');

    // Next server, please.
    return FALSE;
  }
  else {
    $this->detailLog
      ->log('%username: Success at connecting to %id', [
      '%username' => $this->authName,
      '%id' => $this->serverDrupalUser
        ->id(),
    ], 'ldap_authentication');
  }
  return TRUE;
}