You are here

protected function LoginValidatorBase::bindToServer in Lightweight Directory Access Protocol (LDAP) 8.4

Bind to server.

Return value

int Success or failure result.

2 calls to LoginValidatorBase::bindToServer()
LoginValidatorLoginForm::testCredentials in ldap_authentication/src/Controller/LoginValidatorLoginForm.php
Credentials are tested.
LoginValidatorSso::testCredentials in ldap_authentication/src/Controller/LoginValidatorSso.php
@todo Reduce code duplication w/ LoginValidator, split this function up.

File

ldap_authentication/src/Controller/LoginValidatorBase.php, line 902

Class

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

Namespace

Drupal\ldap_authentication\Controller

Code

protected function bindToServer() : int {
  if ($this->serverDrupalUser
    ->get('bind_method') === 'user') {
    return $this
      ->bindToServerAsUser();
  }
  $bindResult = $this->ldapBridge
    ->bind();
  if (!$bindResult) {
    $this->detailLog
      ->log('%username: Unsuccessful with server %id (bind method: %bind_method)', [
      '%username' => $this->authName,
      '%id' => $this->serverDrupalUser
        ->id(),
      '%bind_method' => $this->serverDrupalUser
        ->get('bind_method'),
    ], 'ldap_authentication');
    return self::AUTHENTICATION_FAILURE_BIND;
  }
  return self::AUTHENTICATION_SUCCESS;
}