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);
    }