java.lang.Object
org.neo4j.driver.AuthTokenManagers
@Preview(name="AuthToken rotation and session auth support")
public final class AuthTokenManagers
extends Object
Implementations of
AuthTokenManager
.- Since:
- 5.8
-
Method Summary
Modifier and TypeMethodDescriptionstatic AuthTokenManager
expirationBased
(Supplier<AuthTokenAndExpiration> newTokenSupplier) Returns anAuthTokenManager
that managesAuthToken
instances with UTC expiration timestamp.static AuthTokenManager
expirationBasedAsync
(Supplier<CompletionStage<AuthTokenAndExpiration>> newTokenStageSupplier) Returns anAuthTokenManager
that managesAuthToken
instances with UTC expiration timestamp.
-
Method Details
-
expirationBased
Returns anAuthTokenManager
that managesAuthToken
instances with UTC expiration timestamp.The implementation will only use the token supplier when it needs a new token instance. This includes the following conditions:
- token's UTC timestamp is expired
- server rejects the current token (see
AuthTokenManager.onExpired(AuthToken)
)
The supplier will be called by a task running in the
ForkJoinPool.commonPool()
as documented in theCompletableFuture.supplyAsync(Supplier)
.- Parameters:
newTokenSupplier
- a new token supplier- Returns:
- a new token manager
-
expirationBasedAsync
public static AuthTokenManager expirationBasedAsync(Supplier<CompletionStage<AuthTokenAndExpiration>> newTokenStageSupplier) Returns anAuthTokenManager
that managesAuthToken
instances with UTC expiration timestamp.The implementation will only use the token supplier when it needs a new token instance. This includes the following conditions:
- token's UTC timestamp is expired
- server rejects the current token (see
AuthTokenManager.onExpired(AuthToken)
)
The provided supplier and its completion stages must be non-blocking as documented in the
AuthTokenManager
.- Parameters:
newTokenStageSupplier
- a new token stage supplier- Returns:
- a new token manager
-