vault: Index | Files

package tokenutil

import ""


Package Files


func AddTokenFields Uses

func AddTokenFields(m map[string]*framework.FieldSchema)

AddTokenFields adds fields to an existing role. It panics if it would overwrite an existing field.

func AddTokenFieldsWithAllowList Uses

func AddTokenFieldsWithAllowList(m map[string]*framework.FieldSchema, allowed []string)

AddTokenFields adds fields to an existing role. It panics if it would overwrite an existing field. Allowed can be use to restrict the set, e.g. if there would be conflicts.

func DeprecationText Uses

func DeprecationText(param string) string

func TokenFields Uses

func TokenFields() map[string]*framework.FieldSchema

TokenFields provides a set of field schemas for the parameters

func UpgradeValue Uses

func UpgradeValue(d *framework.FieldData, oldKey, newKey string, oldVal, newVal interface{}) error

UpgradeValue takes in old/new data keys and old/new values and calls out to a helper function to perform upgrades in a standardized way. It reqiures pointers in all cases so that we can set directly into the target struct.

type TokenParams Uses

type TokenParams struct {
    // The set of CIDRs that tokens generated using this role will be bound to
    TokenBoundCIDRs []*sockaddr.SockAddrMarshaler `json:"token_bound_cidrs"`

    // If set, the token entry will have an explicit maximum TTL set, rather
    // than deferring to role/mount values
    TokenExplicitMaxTTL time.Duration `json:"token_explicit_max_ttl" mapstructure:"token_explicit_max_ttl"`

    // The max TTL to use for the token
    TokenMaxTTL time.Duration `json:"token_max_ttl" mapstructure:"token_max_ttl"`

    // If set, core will not automatically add default to the policy list
    TokenNoDefaultPolicy bool `json:"token_no_default_policy" mapstructure:"token_no_default_policy"`

    // The maximum number of times a token issued from this role may be used.
    TokenNumUses int `json:"token_num_uses" mapstructure:"token_num_uses"`

    // If non-zero, tokens created using this role will be able to be renewed
    // forever, but will have a fixed renewal period of this value
    TokenPeriod time.Duration `json:"token_period" mapstructure:"token_period"`

    // The policies to set
    TokenPolicies []string `json:"token_policies" mapstructure:"token_policies"`

    // The type of token this role should issue
    TokenType logical.TokenType `json:"token_type" mapstructure:"token_type"`

    // The TTL to user for the token
    TokenTTL time.Duration `json:"token_ttl" mapstructure:"token_ttl"`

TokenParams contains a set of common parameters that auth plugins can use for setting token behavior

func (*TokenParams) ParseTokenFields Uses

func (t *TokenParams) ParseTokenFields(req *logical.Request, d *framework.FieldData) error

ParseTokenFields provides common field parsing functionality into a TokenFields struct

func (*TokenParams) PopulateTokenAuth Uses

func (t *TokenParams) PopulateTokenAuth(auth *logical.Auth)

PopulateTokenAuth populates Auth with parameters

func (*TokenParams) PopulateTokenData Uses

func (t *TokenParams) PopulateTokenData(m map[string]interface{})

PopulateTokenData adds information from TokenParams into the map

Package tokenutil imports 9 packages (graph) and is imported by 39 packages. Updated 2019-11-08. Refresh now. Tools for package owners.