openapi: Add display attributes for LDAP auth (#19389)
This commit is contained in:
parent
2ec2d050c0
commit
c915dea526
|
@ -14,7 +14,10 @@ import (
|
|||
"github.com/hashicorp/vault/sdk/logical"
|
||||
)
|
||||
|
||||
const errUserBindFailed = `ldap operation failed: failed to bind as user`
|
||||
const (
|
||||
operationPrefixLDAP = "ldap"
|
||||
errUserBindFailed = "ldap operation failed: failed to bind as user"
|
||||
)
|
||||
|
||||
func Factory(ctx context.Context, conf *logical.BackendConfig) (logical.Backend, error) {
|
||||
b := Backend()
|
||||
|
|
|
@ -19,18 +19,31 @@ const userFilterWarning = "userfilter configured does not consider userattr and
|
|||
func pathConfig(b *backend) *framework.Path {
|
||||
p := &framework.Path{
|
||||
Pattern: `config`,
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixLDAP,
|
||||
Action: "Configure",
|
||||
},
|
||||
|
||||
Fields: ldaputil.ConfigFields(),
|
||||
|
||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||
logical.ReadOperation: b.pathConfigRead,
|
||||
logical.UpdateOperation: b.pathConfigWrite,
|
||||
Operations: map[logical.Operation]framework.OperationHandler{
|
||||
logical.ReadOperation: &framework.PathOperation{
|
||||
Callback: b.pathConfigRead,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationSuffix: "auth-configuration",
|
||||
},
|
||||
},
|
||||
logical.UpdateOperation: &framework.PathOperation{
|
||||
Callback: b.pathConfigWrite,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationVerb: "configure-auth",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
HelpSynopsis: pathConfigHelpSyn,
|
||||
HelpDescription: pathConfigHelpDesc,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
Action: "Configure",
|
||||
},
|
||||
}
|
||||
|
||||
tokenutil.AddTokenFields(p.Fields)
|
||||
|
|
|
@ -16,22 +16,33 @@ func pathGroupsList(b *backend) *framework.Path {
|
|||
return &framework.Path{
|
||||
Pattern: "groups/?$",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixLDAP,
|
||||
OperationSuffix: "groups",
|
||||
Navigation: true,
|
||||
ItemType: "Group",
|
||||
},
|
||||
|
||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||
logical.ListOperation: b.pathGroupList,
|
||||
},
|
||||
|
||||
HelpSynopsis: pathGroupHelpSyn,
|
||||
HelpDescription: pathGroupHelpDesc,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
Navigation: true,
|
||||
ItemType: "Group",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func pathGroups(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: `groups/(?P<name>.+)`,
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixLDAP,
|
||||
OperationSuffix: "group",
|
||||
Action: "Create",
|
||||
ItemType: "Group",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"name": {
|
||||
Type: framework.TypeString,
|
||||
|
@ -52,10 +63,6 @@ func pathGroups(b *backend) *framework.Path {
|
|||
|
||||
HelpSynopsis: pathGroupHelpSyn,
|
||||
HelpDescription: pathGroupHelpDesc,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
Action: "Create",
|
||||
ItemType: "Group",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,12 @@ import (
|
|||
func pathLogin(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: `login/(?P<username>.+)`,
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixLDAP,
|
||||
OperationVerb: "log-in",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"username": {
|
||||
Type: framework.TypeString,
|
||||
|
|
|
@ -17,22 +17,33 @@ func pathUsersList(b *backend) *framework.Path {
|
|||
return &framework.Path{
|
||||
Pattern: "users/?$",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixLDAP,
|
||||
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 {
|
||||
return &framework.Path{
|
||||
Pattern: `users/(?P<name>.+)`,
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixLDAP,
|
||||
OperationSuffix: "user",
|
||||
Action: "Create",
|
||||
ItemType: "User",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"name": {
|
||||
Type: framework.TypeString,
|
||||
|
@ -58,10 +69,6 @@ func pathUsers(b *backend) *framework.Path {
|
|||
|
||||
HelpSynopsis: pathUserHelpSyn,
|
||||
HelpDescription: pathUserHelpDesc,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
Action: "Create",
|
||||
ItemType: "User",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue