AuthTokenManager.- Since:
- 5.8
-
Method Summary
Modifier and TypeMethodDescriptionstatic AuthTokenManagerReturns anAuthTokenManagerthat manages basicAuthTokeninstances.static AuthTokenManagerbasicAsync(Supplier<CompletionStage<AuthToken>> newTokenStageSupplier) Returns anAuthTokenManagerthat manages basicAuthTokeninstances.static AuthTokenManagerbearer(Supplier<AuthTokenAndExpiration> newTokenSupplier) Returns anAuthTokenManagerthat manages bearerAuthTokeninstances with UTC expiration timestamp.static AuthTokenManagerbearerAsync(Supplier<CompletionStage<AuthTokenAndExpiration>> newTokenStageSupplier) Returns anAuthTokenManagerthat manages bearerAuthTokeninstances with UTC expiration timestamp.
-
Method Details
-
basic
Returns anAuthTokenManagerthat manages basicAuthTokeninstances.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 anAuthTokenManagerthat manages basicAuthTokeninstances.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 anAuthTokenManagerthat manages bearerAuthTokeninstances 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
TokenExpiredExceptionorAuthenticationException(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 anAuthTokenManagerthat manages bearerAuthTokeninstances 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
TokenExpiredExceptionorAuthenticationException(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
-