- All Known Implementing Classes:
ExpirationBasedAuthTokenManager,StaticAuthTokenManager,ValidatingAuthTokenManager
AuthToken instances used by the driver.
The manager must manage tokens for the same identity. Therefore, it is not intended for a change of identity.
Implementations should supply the same token unless it needs to be updated since a change of token might result in extra processing by the driver.
Driver initializes new connections with a token supplied by the manager. If token changes, driver action depends on connection's Bolt protocol version:
- Bolt 5.1 or above -
LOGOFFandLOGONmessages are dispatched to update the token on next interaction - Bolt 5.0 or below - connection is closed an a new one is initialized with the new token
All implementations of this interface must be thread-safe and non-blocking for caller threads. For instance, IO operations must not be done on the calling thread.
- Since:
- 5.8
-
Method Summary
Modifier and TypeMethodDescriptiongetToken()Returns aCompletionStagefor a validAuthToken.voidHandles an error notification emitted by the server if the token is expired.
-
Method Details
-
getToken
CompletionStage<AuthToken> getToken()Returns aCompletionStagefor a validAuthToken.Driver invokes this method often to check if token has changed.
Failures will surface via the driver API, like
Session.beginTransaction()method and others.- Returns:
- a stage for a valid token, must not be
nullor complete withnull - See Also:
-
onExpired
Handles an error notification emitted by the server if the token is expired.This will be called when driver emits the
TokenExpiredRetryableException.- Parameters:
authToken- the expired token
-