Class VaultToken

java.lang.Object
io.quarkus.vault.client.auth.VaultTimeLimited
io.quarkus.vault.client.auth.VaultToken

public class VaultToken extends VaultTimeLimited
  • Constructor Details

  • 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

      public static VaultToken neverExpires(String clientToken, InstantSource instantSource)
    • cached

      public VaultToken cached()
    • getClientToken

      public String getClientToken()
    • getAllowedUsesRemaining

      public int getAllowedUsesRemaining()
    • hasAllowedUsesRemaining

      public boolean hasAllowedUsesRemaining()
    • isFromCache

      public boolean isFromCache()
    • getClientTokenForUsage

      public String 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. The VaultClient implementation 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: VaultTimeLimited
      Check 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:
      isValid in class VaultTimeLimited
      Returns:
      true if the token is valid, false otherwise
    • getConfidentialInfo

      public String getConfidentialInfo(LogConfidentialityLevel level)