Class LoginToken

java.lang.Object
org.springframework.vault.support.VaultToken
org.springframework.vault.authentication.LoginToken

public class LoginToken extends VaultToken
Value object for a Vault token obtained by a login method.
Author:
Mark Paluch
  • Method Details

    • builder

      public static LoginToken.LoginTokenBuilder builder()
      Returns:
      a new LoginToken.LoginTokenBuilder.
      Since:
      3.0.2
    • of

      public static LoginToken of(String token)
      Create a new LoginToken.
      Parameters:
      token - must not be null.
      Returns:
      the created VaultToken
    • of

      public static LoginToken of(char[] token)
      Create a new LoginToken.
      Parameters:
      token - must not be null.
      Returns:
      the created VaultToken
      Since:
      1.1
    • of

      public static LoginToken of(char[] token, Duration leaseDuration)
      Create a new LoginToken with a leaseDurationSeconds.
      Parameters:
      token - must not be null.
      leaseDuration - the lease duration, must not be negative and not be null.
      Returns:
      the created VaultToken
      Since:
      2.0
    • renewable

      public static LoginToken renewable(VaultToken token, Duration leaseDuration)
      Create a new renewable LoginToken with a leaseDurationSeconds.
      Parameters:
      token - must not be null.
      leaseDuration - the lease duration, must not be null or negative.
      Returns:
      the created VaultToken
      Since:
      2.0
    • renewable

      public static LoginToken renewable(char[] token, Duration leaseDuration)
      Create a new renewable LoginToken with a leaseDurationSeconds.
      Parameters:
      token - must not be null.
      leaseDuration - the lease duration, must not be null or negative.
      Returns:
      the created VaultToken
      Since:
      2.0
    • getLeaseDuration

      public Duration getLeaseDuration()
      Returns:
      the lease duration in seconds. May be 0 if none.
    • isRenewable

      public boolean isRenewable()
      Returns:
      true if this token is renewable; false otherwise.
    • getAccessor

      @Nullable public String getAccessor()
      Returns:
      the token accessor.
      Since:
      3.0.2
    • getType

      @Nullable public String getType()
      Returns:
      the token type.
      Since:
      3.0.2
      See Also:
    • isBatchToken

      public boolean isBatchToken()
      Returns:
      true if the token is a batch token.
      Since:
      3.0.2
    • isServiceToken

      public boolean isServiceToken()
      Returns:
      true if the token is a service token.
      Since:
      3.0.2
    • toString

      public String toString()
      Overrides:
      toString in class VaultToken