openapi: Add display attributes for GitHub auth (#19384)
Please see https://github.com/hashicorp/vault/pull/19319 for more details on how this will affect the generated OpenAPI schema. ____ ### The following OperationID's will be generated for GitHub auth: github-read-configuration github-configure github-log-in github-read-teams github-read-team-mapping github-write-team-mapping github-delete-team-mapping github-read-users github-read-user-mapping github-write-user-mapping github-delete-user-mapping
This commit is contained in:
parent
7ed4a429f7
commit
33bc8f5d00
|
@ -14,6 +14,8 @@ import (
|
|||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
const operationPrefixGithub = "github"
|
||||
|
||||
func Factory(ctx context.Context, conf *logical.BackendConfig) (logical.Backend, error) {
|
||||
b := Backend()
|
||||
if err := b.Setup(ctx, conf); err != nil {
|
||||
|
@ -31,6 +33,17 @@ func Backend() *backend {
|
|||
DefaultKey: "default",
|
||||
}
|
||||
|
||||
teamMapPaths := b.TeamMap.Paths()
|
||||
|
||||
teamMapPaths[0].DisplayAttrs = &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixGithub,
|
||||
OperationSuffix: "teams",
|
||||
}
|
||||
teamMapPaths[1].DisplayAttrs = &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixGithub,
|
||||
OperationSuffix: "team-mapping",
|
||||
}
|
||||
|
||||
b.UserMap = &framework.PolicyMap{
|
||||
PathMap: framework.PathMap{
|
||||
Name: "users",
|
||||
|
@ -38,7 +51,18 @@ func Backend() *backend {
|
|||
DefaultKey: "default",
|
||||
}
|
||||
|
||||
allPaths := append(b.TeamMap.Paths(), b.UserMap.Paths()...)
|
||||
userMapPaths := b.UserMap.Paths()
|
||||
|
||||
userMapPaths[0].DisplayAttrs = &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixGithub,
|
||||
OperationSuffix: "users",
|
||||
}
|
||||
userMapPaths[1].DisplayAttrs = &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixGithub,
|
||||
OperationSuffix: "user-mapping",
|
||||
}
|
||||
|
||||
allPaths := append(teamMapPaths, userMapPaths...)
|
||||
b.Backend = &framework.Backend{
|
||||
Help: backendHelp,
|
||||
|
||||
|
|
|
@ -20,6 +20,11 @@ import (
|
|||
func pathConfig(b *backend) *framework.Path {
|
||||
p := &framework.Path{
|
||||
Pattern: "config",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixGithub,
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"organization": {
|
||||
Type: framework.TypeString,
|
||||
|
@ -52,9 +57,20 @@ API-compatible authentication server.`,
|
|||
},
|
||||
},
|
||||
|
||||
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||
logical.UpdateOperation: b.pathConfigWrite,
|
||||
logical.ReadOperation: b.pathConfigRead,
|
||||
Operations: map[logical.Operation]framework.OperationHandler{
|
||||
logical.UpdateOperation: &framework.PathOperation{
|
||||
Callback: b.pathConfigWrite,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixGithub,
|
||||
OperationVerb: "configure",
|
||||
},
|
||||
},
|
||||
logical.ReadOperation: &framework.PathOperation{
|
||||
Callback: b.pathConfigRead,
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationSuffix: "configuration",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,12 @@ import (
|
|||
func pathLogin(b *backend) *framework.Path {
|
||||
return &framework.Path{
|
||||
Pattern: "login",
|
||||
|
||||
DisplayAttrs: &framework.DisplayAttributes{
|
||||
OperationPrefix: operationPrefixGithub,
|
||||
OperationVerb: "log-in",
|
||||
},
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"token": {
|
||||
Type: framework.TypeString,
|
||||
|
|
Loading…
Reference in New Issue