Package io.quarkus.vault.client.auth
Class VaultToken
java.lang.Object
io.quarkus.vault.client.auth.VaultTimeLimited
io.quarkus.vault.client.auth.VaultToken
-
Constructor Summary
ConstructorsConstructorDescriptionVaultToken(String clientToken, boolean renewable, Duration leaseDuration, Integer allowedUsesRemaining, boolean fromCache, InstantSource instantSource) VaultToken(String clientToken, boolean renewable, Duration leaseDuration, Instant created, boolean fromCache, AtomicInteger allowedUsesRemaining, InstantSource instantSource) -
Method Summary
Modifier and TypeMethodDescriptioncached()static VaultTokenfrom(String clientToken, boolean renewable, Duration leaseDuration, Integer allowedUsesRemaining, InstantSource instantSource) intReturns the client token for usage, decrementing the allowed uses remaining.booleanbooleanbooleanisValid()Check if the token is valid, in the sense that using it for authentication *should* be successful.static VaultTokenneverExpires(String clientToken, InstantSource instantSource) static VaultTokenrenewable(String clientToken, Duration leaseDuration, Integer allowedUsesRemaining, InstantSource instantSource) Methods inherited from class io.quarkus.vault.client.auth.VaultTimeLimited
getCreated, getExpiresAt, getInstantSource, getLeaseDuration, info, isExpired, isExpiringWithin, isRenewable, leaseDurationSanityCheck, shouldExtend
-
Constructor Details
-
VaultToken
public VaultToken(String clientToken, boolean renewable, Duration leaseDuration, Integer allowedUsesRemaining, boolean fromCache, InstantSource instantSource) -
VaultToken
public VaultToken(String clientToken, boolean renewable, Duration leaseDuration, Instant created, boolean fromCache, AtomicInteger allowedUsesRemaining, InstantSource instantSource)
-
-
Method Details
-
from
public static VaultToken from(String clientToken, boolean renewable, Duration leaseDuration, Integer allowedUsesRemaining, InstantSource instantSource) -
renewable
public static VaultToken renewable(String clientToken, Duration leaseDuration, Integer allowedUsesRemaining, InstantSource instantSource) -
neverExpires
-
cached
-
getClientToken
-
getAllowedUsesRemaining
public int getAllowedUsesRemaining() -
hasAllowedUsesRemaining
public boolean hasAllowedUsesRemaining() -
isFromCache
public boolean isFromCache() -
getClientTokenForUsage
Returns the client token for usage, decrementing the allowed uses remaining.During normal operation, this method should always return the client token, as the remaining use count should be checked before calling this method. However, if the token is requested for use multiple times in parallel, it is possible that the use count will be exhausted between the check and the call to this method. In that case, the method will throw a
VaultTokenException. TheVaultClientimplementation should handle this exception and retry the request, after obtaining a new token (if possible).- Returns:
- the client token
- Throws:
VaultTokenException- if the token has no allowed uses remaining
-
isValid
public boolean isValid()Description copied from class:VaultTimeLimitedCheck if the token is valid, in the sense that using it for authentication *should* be successful.This base class implementation checks if the token is expired, but subclasses may override this method to provide additional checks.
- Overrides:
isValidin classVaultTimeLimited- Returns:
- true if the token is valid, false otherwise
-
getConfidentialInfo
-