Class TokenRole.Builder

  • Enclosing class:
    TokenRole

    public static final class TokenRole.Builder
    extends Object
    A builder for vault token roles.
    Since:
    0.9
    Author:
    Stefan Kalscheuer
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • forName

        public TokenRole.Builder forName​(String name)
        Add token role name.
        Parameters:
        name - role name
        Returns:
        self
      • withAllowedPolicy

        public TokenRole.Builder withAllowedPolicy​(String allowedPolicy)
        Add an allowed policy.
        Parameters:
        allowedPolicy - allowed policy to add
        Returns:
        self
      • withAllowedPolicies

        public TokenRole.Builder withAllowedPolicies​(List<String> allowedPolicies)
        Add allowed policies.
        Parameters:
        allowedPolicies - list of allowed policies
        Returns:
        self
      • withDisallowedPolicy

        public TokenRole.Builder withDisallowedPolicy​(String disallowedPolicy)
        Add a disallowed policy.
        Parameters:
        disallowedPolicy - disallowed policy to add
        Returns:
        self
      • withDisallowedPolicies

        public TokenRole.Builder withDisallowedPolicies​(List<String> disallowedPolicies)
        Add disallowed policies.
        Parameters:
        disallowedPolicies - list of disallowed policies
        Returns:
        self
      • orphan

        public TokenRole.Builder orphan​(Boolean orphan)
        Set TRUE if the token role should be created orphan.
        Parameters:
        orphan - if TRUE, token role is created as orphan
        Returns:
        self
      • renewable

        public TokenRole.Builder renewable​(Boolean renewable)
        Set TRUE if the token role should be created renewable.
        Parameters:
        renewable - if TRUE, token role is created renewable
        Returns:
        self
      • withPathSuffix

        public TokenRole.Builder withPathSuffix​(String pathSuffix)
        Set token role path suffix.
        Parameters:
        pathSuffix - path suffix to use
        Returns:
        self
      • withAllowedEntityAlias

        public TokenRole.Builder withAllowedEntityAlias​(String allowedEntityAlias)
        Add an allowed entity alias.
        Parameters:
        allowedEntityAlias - allowed entity alias to add
        Returns:
        self
      • withAllowedEntityAliases

        public TokenRole.Builder withAllowedEntityAliases​(List<String> allowedEntityAliases)
        Add allowed entity aliases.
        Parameters:
        allowedEntityAliases - list of allowed entity aliases to add
        Returns:
        self
      • withTokenBoundCidr

        public TokenRole.Builder withTokenBoundCidr​(String tokenBoundCidr)
        Add a single bound CIDR.
        Parameters:
        tokenBoundCidr - bound CIDR to add
        Returns:
        self
      • withTokenBoundCidrs

        public TokenRole.Builder withTokenBoundCidrs​(List<String> tokenBoundCidrs)
        Add a list of bound CIDRs.
        Parameters:
        tokenBoundCidrs - list of bound CIDRs to add
        Returns:
        self
      • withTokenExplicitMaxTtl

        public TokenRole.Builder withTokenExplicitMaxTtl​(Integer tokenExplicitMaxTtl)
        Set explicit max. TTL for token.
        Parameters:
        tokenExplicitMaxTtl - explicit maximum TTL
        Returns:
        self
      • withTokenNoDefaultPolicy

        public TokenRole.Builder withTokenNoDefaultPolicy​(Boolean tokenNoDefaultPolicy)
        Set TRUE if the token role should be created renewable.
        Parameters:
        tokenNoDefaultPolicy - if TRUE, token is created without default policy.
        Returns:
        self
      • withTokenNumUses

        public TokenRole.Builder withTokenNumUses​(Integer tokenNumUses)
        Set number of uses for tokens.
        Parameters:
        tokenNumUses - number of uses for associated tokens.
        Returns:
        self
      • withTokenPeriod

        public TokenRole.Builder withTokenPeriod​(Integer tokenPeriod)
        Set token period.
        Parameters:
        tokenPeriod - token period
        Returns:
        self
      • withTokenType

        public TokenRole.Builder withTokenType​(Token.Type tokenType)
        Set token type.
        Parameters:
        tokenType - token type
        Returns:
        self
      • build

        public TokenRole build()
        Build the token based on given parameters.
        Returns:
        the token