Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

## [Unreleased]

- fixed closing connection on failed authentication (#ES-772)

## [6.8.1] - 2020-12-22

- fixed ignoring internal endpoints in acquireHostList (#DEVSUP-673)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@

import com.arangodb.ArangoDBException;
import com.arangodb.internal.ArangoDefaults;
import com.arangodb.internal.net.*;
import com.arangodb.internal.net.AccessType;
import com.arangodb.internal.net.ArangoDBRedirectException;
import com.arangodb.internal.net.Host;
import com.arangodb.internal.net.HostDescription;
import com.arangodb.internal.net.HostHandle;
import com.arangodb.internal.net.HostHandler;
import com.arangodb.internal.util.HostUtils;
import com.arangodb.internal.util.RequestUtils;
import com.arangodb.internal.util.ResponseUtils;
Expand Down Expand Up @@ -87,7 +92,7 @@ protected synchronized C connect(final HostHandle hostHandle, final AccessType a
connection.open();
hostHandler.success();
if (user != null) {
authenticate(connection);
tryAuthenticate(connection);
}
hostHandler.confirm();
return connection;
Expand All @@ -111,6 +116,15 @@ protected synchronized C connect(final HostHandle hostHandle, final AccessType a
}
}

private void tryAuthenticate(final C connection) {
try {
authenticate(connection);
} catch (final ArangoDBException authException) {
connection.close();
throw authException;
}
}

protected abstract void authenticate(final C connection);

@Override
Expand Down