From 24e346bf53121fe90b0642c974d127b7f111b67d Mon Sep 17 00:00:00 2001 From: davidadeleon <56207066+davidadeleon@users.noreply.github.com> Date: Thu, 1 Sep 2022 08:32:40 -0400 Subject: [PATCH] auth/token: Fix ignored parameter warnings for valid parameters on token create (#16938) * Add fields to schema for relevant paths * add changelog --- changelog/16938.txt | 3 + vault/token_store.go | 181 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 changelog/16938.txt diff --git a/changelog/16938.txt b/changelog/16938.txt new file mode 100644 index 000000000..6fb00bfdf --- /dev/null +++ b/changelog/16938.txt @@ -0,0 +1,3 @@ +```release-note:bug +auth/token: Fix ignored parameter warnings for valid parameters on token create +``` diff --git a/vault/token_store.go b/vault/token_store.go index 0a922dcf0..f1dfb1145 100644 --- a/vault/token_store.go +++ b/vault/token_store.go @@ -157,6 +157,70 @@ func (ts *TokenStore) paths() []*framework.Path { { Pattern: "create-orphan$", + Fields: map[string]*framework.FieldSchema{ + "role_name": { + Type: framework.TypeString, + Description: "Name of the role", + }, + "display_name": { + Type: framework.TypeString, + Description: "Name to associate with this token", + }, + "explicit_max_ttl": { + Type: framework.TypeString, + Description: "Explicit Max TTL of this token", + }, + "entity_alias": { + Type: framework.TypeString, + Description: "Name of the entity alias to associate with this token", + }, + "num_uses": { + Type: framework.TypeInt, + Description: "Max number of uses for this token", + }, + "period": { + Type: framework.TypeString, + Description: "Renew period", + }, + "renewable": { + Type: framework.TypeBool, + Description: "Allow token to be renewed past its initial TTL up to system/mount maximum TTL", + }, + "ttl": { + Type: framework.TypeString, + Description: "Time to live for this token", + }, + "type": { + Type: framework.TypeString, + Description: "Token type", + }, + "no_default_policy": { + Type: framework.TypeBool, + Description: "Do not include default policy for this token", + }, + "id": { + Type: framework.TypeString, + Description: "Value for the token", + }, + "metadata": { + Type: framework.TypeMap, + Description: "Arbitrary key=value metadata to associate with the token", + }, + "no_parent": { + Type: framework.TypeBool, + Description: "Create the token with no parent", + }, + "policies": { + Type: framework.TypeStringSlice, + Description: "List of policies for the token", + }, + "format": { + Type: framework.TypeString, + Query: true, + Description: "Return json formatted output", + }, + }, + Callbacks: map[logical.Operation]framework.OperationFunc{ logical.UpdateOperation: ts.handleCreateOrphan, }, @@ -173,6 +237,63 @@ func (ts *TokenStore) paths() []*framework.Path { Type: framework.TypeString, Description: "Name of the role", }, + "display_name": { + Type: framework.TypeString, + Description: "Name to associate with this token", + }, + "explicit_max_ttl": { + Type: framework.TypeString, + Description: "Explicit Max TTL of this token", + }, + "entity_alias": { + Type: framework.TypeString, + Description: "Name of the entity alias to associate with this token", + }, + "num_uses": { + Type: framework.TypeInt, + Description: "Max number of uses for this token", + }, + "period": { + Type: framework.TypeString, + Description: "Renew period", + }, + "renewable": { + Type: framework.TypeBool, + Description: "Allow token to be renewed past its initial TTL up to system/mount maximum TTL", + }, + "ttl": { + Type: framework.TypeString, + Description: "Time to live for this token", + }, + "type": { + Type: framework.TypeString, + Description: "Token type", + }, + "no_default_policy": { + Type: framework.TypeBool, + Description: "Do not include default policy for this token", + }, + "id": { + Type: framework.TypeString, + Description: "Value for the token", + }, + "metadata": { + Type: framework.TypeMap, + Description: "Arbitrary key=value metadata to associate with the token", + }, + "no_parent": { + Type: framework.TypeBool, + Description: "Create the token with no parent", + }, + "policies": { + Type: framework.TypeStringSlice, + Description: "List of policies for the token", + }, + "format": { + Type: framework.TypeString, + Query: true, + Description: "Return json formatted output", + }, }, Callbacks: map[logical.Operation]framework.OperationFunc{ @@ -186,6 +307,66 @@ func (ts *TokenStore) paths() []*framework.Path { { Pattern: "create$", + Fields: map[string]*framework.FieldSchema{ + "display_name": { + Type: framework.TypeString, + Description: "Name to associate with this token", + }, + "explicit_max_ttl": { + Type: framework.TypeString, + Description: "Explicit Max TTL of this token", + }, + "entity_alias": { + Type: framework.TypeString, + Description: "Name of the entity alias to associate with this token", + }, + "num_uses": { + Type: framework.TypeInt, + Description: "Max number of uses for this token", + }, + "period": { + Type: framework.TypeString, + Description: "Renew period", + }, + "renewable": { + Type: framework.TypeBool, + Description: "Allow token to be renewed past its initial TTL up to system/mount maximum TTL", + }, + "ttl": { + Type: framework.TypeString, + Description: "Time to live for this token", + }, + "type": { + Type: framework.TypeString, + Description: "Token type", + }, + "no_default_policy": { + Type: framework.TypeBool, + Description: "Do not include default policy for this token", + }, + "id": { + Type: framework.TypeString, + Description: "Value for the token", + }, + "metadata": { + Type: framework.TypeMap, + Description: "Arbitrary key=value metadata to associate with the token", + }, + "no_parent": { + Type: framework.TypeBool, + Description: "Create the token with no parent", + }, + "policies": { + Type: framework.TypeStringSlice, + Description: "List of policies for the token", + }, + "format": { + Type: framework.TypeString, + Query: true, + Description: "Return json formatted output", + }, + }, + Callbacks: map[logical.Operation]framework.OperationFunc{ logical.UpdateOperation: ts.handleCreate, },