AuthTokenManager
.- Since:
- 5.8
-
Method Summary
Modifier and TypeMethodDescriptionstatic AuthTokenManager
Returns anAuthTokenManager
that manages basicAuthToken
instances.static AuthTokenManager
basicAsync
(Supplier<CompletionStage<AuthToken>> newTokenStageSupplier) Returns anAuthTokenManager
that manages basicAuthToken
instances.static AuthTokenManager
bearer
(Supplier<AuthTokenAndExpiration> newTokenSupplier) Returns anAuthTokenManager
that manages bearerAuthToken
instances with UTC expiration timestamp.static AuthTokenManager
bearerAsync
(Supplier<CompletionStage<AuthTokenAndExpiration>> newTokenStageSupplier) Returns anAuthTokenManager
that manages bearerAuthToken
instances with UTC expiration timestamp.
-
Method Details
-
basic
Returns anAuthTokenManager
that manages basicAuthToken
instances.The implementation will only use the token supplier when it needs a new token instance, which would happen if the server rejects the current token with
AuthenticationException
(seeAuthTokenManager.handleSecurityException(AuthToken, SecurityException)
). The provided supplier and its completion stages must be non-blocking as documented in theAuthTokenManager
.- Parameters:
newTokenSupplier
- a new token stage supplier- Returns:
- a new token manager
- Since:
- 5.12
-
basicAsync
public static AuthTokenManager basicAsync(Supplier<CompletionStage<AuthToken>> newTokenStageSupplier) Returns anAuthTokenManager
that manages basicAuthToken
instances.The implementation will only use the token supplier when it needs a new token instance, which would happen if the server rejects the current token with
AuthenticationException
(seeAuthTokenManager.handleSecurityException(AuthToken, SecurityException)
). The provided supplier and its completion stages must be non-blocking as documented in theAuthTokenManager
.- Parameters:
newTokenStageSupplier
- a new token stage supplier- Returns:
- a new token manager
- Since:
- 5.12
-
bearer
Returns anAuthTokenManager
that manages bearerAuthToken
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 with either
TokenExpiredException
orAuthenticationException
(seeAuthTokenManager.handleSecurityException(AuthToken, SecurityException)
)
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
- Since:
- 5.12
-
bearerAsync
public static AuthTokenManager bearerAsync(Supplier<CompletionStage<AuthTokenAndExpiration>> newTokenStageSupplier) Returns anAuthTokenManager
that manages bearerAuthToken
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 with either
TokenExpiredException
orAuthenticationException
(seeAuthTokenManager.handleSecurityException(AuthToken, SecurityException)
)
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
- Since:
- 5.12
-