Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of auth/token: Fix ignored parameter warnings for valid parameters on token create into release/1.10.x #16976

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/16938.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
auth/token: Fix ignored parameter warnings for valid parameters on token create
```
181 changes: 181 additions & 0 deletions vault/token_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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{
Expand All @@ -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,
},
Expand Down