Back to

package tokenutil

Latest Go to latest
Published: Jul 25, 2019 | License: MPL-2.0 | Module:


func AddTokenFields

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

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

func DeprecationText(param string) string

func TokenFields

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

TokenFields provides a set of field schemas for the parameters

func UpgradeValue

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

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

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

ParseTokenFields provides common field parsing functionality into a TokenFields struct

func (*TokenParams) PopulateTokenAuth

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

PopulateTokenAuth populates Auth with parameters

func (*TokenParams) PopulateTokenData

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

PopulateTokenData adds information from TokenParams into the map

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier