Class Auth.TokenRequest

java.lang.Object
io.github.jopenlibs.vault.api.Auth.TokenRequest
All Implemented Interfaces:
Serializable
Enclosing class:
Auth

public static class Auth.TokenRequest extends Object implements Serializable

A container for all of the options that can be passed to the createToken(TokenRequest) method, to avoid that method having an excessive number of parameters (with null typically passed to most of them).

All properties here are optional. Use of this class resembles a builder pattern (i.e. call the mutator method for each property you wish to set), but this class lacks a final build() method as no post-initialization logic is necessary.

See Also:
  • Constructor Details

    • TokenRequest

      public TokenRequest()
  • Method Details

    • id

      public Auth.TokenRequest id(UUID id)
      Parameters:
      id - (optional) The ID of the client token. Can only be specified by a root token. Otherwise, the token ID is a randomly generated UUID.
      Returns:
      This object, with its id field populated
    • polices

      public Auth.TokenRequest polices(List<String> polices)
      Parameters:
      polices - (optional) A list of policies for the token. This must be a subset of the policies belonging to the token
      Returns:
      This object, with its polices field populated
    • meta

      public Auth.TokenRequest meta(Map<String,String> meta)
      Parameters:
      meta - (optional) A map of string to string valued metadata. This is passed through to the audit backends.
      Returns:
      This object, with its meta field populated
    • noParent

      public Auth.TokenRequest noParent(Boolean noParent)
      Parameters:
      noParent - (optional) If true and set by a root caller, the token will not have the parent token of the caller. This creates a token with no parent.
      Returns:
      This object, with its noParent field populated
    • noDefaultPolicy

      public Auth.TokenRequest noDefaultPolicy(Boolean noDefaultPolicy)
      Parameters:
      noDefaultPolicy - (optional) If true the default policy will not be a part of this token's policy set.
      Returns:
      This object, with its noDefaultPolicy field populated
    • ttl

      public Auth.TokenRequest ttl(String ttl)
      Parameters:
      ttl - (optional) The TTL period of the token, provided as "1h", where hour is the largest suffix. If not provided, the token is valid for the default lease TTL, or indefinitely if the root policy is used.
      Returns:
      This object, with its ttl field populated
    • displayName

      public Auth.TokenRequest displayName(String displayName)
      Parameters:
      displayName - (optional) The display name of the token. Defaults to "token".
      Returns:
      This object, with its displayName field populated
    • numUses

      public Auth.TokenRequest numUses(Long numUses)
      Parameters:
      numUses - (optional) The maximum uses for the given token. This can be used to create a one-time-token or limited use token. Defaults to 0, which has no limit to the number of uses.
      Returns:
      This object, with its numUses field populated
    • role

      public Auth.TokenRequest role(String role)
      Parameters:
      role - (optional) The role the token will be created with. Default is no role.
      Returns:
      This object, with its role field populated
    • renewable

      public Auth.TokenRequest renewable(Boolean renewable)
      Parameters:
      renewable - Set to false to disable the ability of the token to be renewed past its initial TTL. Setting the value to true will allow the token to be renewable up to the system/mount maximum TTL.
      Returns:
      This object, with its renewable field populated
    • type

      public Auth.TokenRequest type(String type)
      Parameters:
      type - The token type. Can be "batch" or "service".
      Returns:
      This object, with its type field populated
    • explicitMaxTtl

      public Auth.TokenRequest explicitMaxTtl(String explicitMaxTtl)
      Parameters:
      explicitMaxTtl - If set, the token will have an explicit max TTL set upon it.
      Returns:
      This object, with its explicitMaxTtl field populated
    • period

      public Auth.TokenRequest period(String period)
      Parameters:
      period - If specified, the token will be periodic
      Returns:
      This object, with its period field populated
    • entityAlias

      public Auth.TokenRequest entityAlias(String entityAlias)
      Parameters:
      entityAlias - Name of the entity alias to associate with during token creation.
      Returns:
      This object, with its period field populated
    • getId

      public UUID getId()
    • getPolices

      public List<String> getPolices()
    • getMeta

      public Map<String,String> getMeta()
    • getNoParent

      public Boolean getNoParent()
    • getNoDefaultPolicy

      public Boolean getNoDefaultPolicy()
    • getTtl

      public String getTtl()
    • getDisplayName

      public String getDisplayName()
    • getNumUses

      public Long getNumUses()
    • getRole

      public String getRole()
    • getRenewable

      public Boolean getRenewable()
    • getType

      public String getType()
    • getExplicitMaxTtl

      public String getExplicitMaxTtl()
    • getPeriod

      public String getPeriod()
    • getEntityAlias

      public String getEntityAlias()