openapi: Add display attributes for userpass (#19411)
This commit is contained in:
parent
9a654ac3f1
commit
c8803cb571
|
@ -10,6 +10,8 @@ import (
|
|||
"github.com/hashicorp/vault/sdk/logical"
|
||||
)
|
||||
|
||||
const operationPrefixUserpass = "userpass"
|
||||
|
||||
func Factory(ctx context.Context, conf *logical.BackendConfig) (logical.Backend, error) {
|
||||
b := Backend()
|
||||
if err := b.Setup(ctx, conf); err != nil {
|
||||
|
|
|
@ -19,6 +19,12 @@ import (
|
|||
func pathLogin(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "login/" + framework.GenericNameRegex("username"),
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixUserpass,
|
||||
OperationVerb: "log-in",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"username": {
|
||||
Type: framework.TypeString,
|
||||
|
|
|
@ -16,6 +16,13 @@ import (
|
|||
func pathUserPassword(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "users/" + framework.GenericNameRegex("username") + "/password$",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixUserpass,
|
||||
OperationVerb: "reset",
|
||||
OperationSuffix: "password",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"username": {
|
||||
Type: framework.TypeString,
|
||||
|
|
|
@ -16,6 +16,13 @@ import (
|
|||
func pathUserPolicies(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "users/" + framework.GenericNameRegex("username") + "/policies$",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixUserpass,
|
||||
OperationVerb: "update",
|
||||
OperationSuffix: "policies",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"username": {
|
||||
Type: framework.TypeString,
|
||||
|
|
|
@ -19,22 +19,33 @@ func pathUsersList(b *backend) *framework.Path {
|
|||
return &framework.Path{
|
||||
Pattern: "users/?",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixUserpass,
|
||||
OperationSuffix: "users",
|
||||
Navigation: true,
|
||||
ItemType: "User",
|
||||
},
|
||||
|
||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||
logical.ListOperation: b.pathUserList,
|
||||
},
|
||||
|
||||
HelpSynopsis: pathUserHelpSyn,
|
||||
HelpDescription: pathUserHelpDesc,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
Navigation: true,
|
||||
ItemType: "User",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func pathUsers(b *backend) *framework.Path {
|
||||
p := &framework.Path{
|
||||
Pattern: "users/" + framework.GenericNameRegex("username"),
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixUserpass,
|
||||
OperationSuffix: "user",
|
||||
Action: "Create",
|
||||
ItemType: "User",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"username": {
|
||||
Type: framework.TypeString,
|
||||
|
@ -85,10 +96,6 @@ func pathUsers(b *backend) *framework.Path {
|
|||
|
||||
HelpSynopsis: pathUserHelpSyn,
|
||||
HelpDescription: pathUserHelpDesc,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
Action: "Create",
|
||||
ItemType: "User",
|
||||
},
|
||||
}
|
||||
|
||||
tokenutil.AddTokenFields(p.Fields)
|
||||
|
|
Loading…
Reference in New Issue