Class Auth.TokenRequest

  • All Implemented Interfaces:
    java.io.Serializable
    Enclosing class:
    Auth

    public static class Auth.TokenRequest
    extends java.lang.Object
    implements java.io.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:
    Serialized Form
    • Constructor Detail

      • TokenRequest

        public TokenRequest()
    • Method Detail

      • id

        public Auth.TokenRequest id​(java.util.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​(java.util.List<java.lang.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​(java.util.Map<java.lang.String,​java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String period)
        Parameters:
        period - If specified, the token will be periodic
        Returns:
        This object, with its period field populated
      • entityAlias

        public Auth.TokenRequest entityAlias​(java.lang.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 java.util.UUID getId()
      • getPolices

        public java.util.List<java.lang.String> getPolices()
      • getMeta

        public java.util.Map<java.lang.String,​java.lang.String> getMeta()
      • getNoParent

        public java.lang.Boolean getNoParent()
      • getNoDefaultPolicy

        public java.lang.Boolean getNoDefaultPolicy()
      • getTtl

        public java.lang.String getTtl()
      • getDisplayName

        public java.lang.String getDisplayName()
      • getNumUses

        public java.lang.Long getNumUses()
      • getRole

        public java.lang.String getRole()
      • getRenewable

        public java.lang.Boolean getRenewable()
      • getType

        public java.lang.String getType()
      • getExplicitMaxTtl

        public java.lang.String getExplicitMaxTtl()
      • getPeriod

        public java.lang.String getPeriod()
      • getEntityAlias

        public java.lang.String getEntityAlias()