LdapTools\Operation\Handler\AuthenticationOperationHandler::getAuthenticationResponse PHP Method

getAuthenticationResponse() protected method

Attempts to connect with the given credentials and returns the response.
protected getAuthenticationResponse ( AuthenticationOperation $operation ) : AuthenticationResponse
$operation LdapTools\Operation\AuthenticationOperation
return LdapTools\Operation\AuthenticationResponse
    protected function getAuthenticationResponse(AuthenticationOperation $operation)
    {
        $authenticated = false;
        $errorMessage = null;
        $errorCode = null;
        // Only catch a bind failure. Let the others through, as it's probably a sign of other issues.
        try {
            $authenticated = (bool) $this->connection->close()->connect(...$operation->getArguments());
        } catch (LdapBindException $e) {
            $errorMessage = $this->connection->getLastError();
            $errorCode = $this->connection->getExtendedErrorNumber();
        }
        return new AuthenticationResponse($authenticated, $errorMessage, $errorCode);
    }