mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
Add separate path for capabilities-self to enable ACL
This commit is contained in:
@@ -44,10 +44,7 @@ func Handler(core *vault.Core) http.Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sysCapabilitiesCallback(req *logical.Request) error {
|
func sysCapabilitiesCallback(req *logical.Request) error {
|
||||||
if req.Path == "sys/capabilities-self" {
|
req.Data["token"] = req.ClientToken
|
||||||
req.Path = "sys/capabilities"
|
|
||||||
req.Data["token"] = req.ClientToken
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,27 @@ func NewSystemBackend(core *Core, config *logical.BackendConfig) logical.Backend
|
|||||||
HelpSynopsis: strings.TrimSpace(sysHelp["capabilities"][0]),
|
HelpSynopsis: strings.TrimSpace(sysHelp["capabilities"][0]),
|
||||||
HelpDescription: strings.TrimSpace(sysHelp["capabilities"][0]),
|
HelpDescription: strings.TrimSpace(sysHelp["capabilities"][0]),
|
||||||
},
|
},
|
||||||
|
&framework.Path{
|
||||||
|
Pattern: "capabilities-self$",
|
||||||
|
|
||||||
|
Fields: map[string]*framework.FieldSchema{
|
||||||
|
"token": &framework.FieldSchema{
|
||||||
|
Type: framework.TypeString,
|
||||||
|
Description: "Token for which capabilities are being queried.",
|
||||||
|
},
|
||||||
|
"path": &framework.FieldSchema{
|
||||||
|
Type: framework.TypeString,
|
||||||
|
Description: "Path on which capabilities are being queried.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
Callbacks: map[logical.Operation]framework.OperationFunc{
|
||||||
|
logical.UpdateOperation: b.handleCapabilities,
|
||||||
|
},
|
||||||
|
|
||||||
|
HelpSynopsis: strings.TrimSpace(sysHelp["capabilities"][0]),
|
||||||
|
HelpDescription: strings.TrimSpace(sysHelp["capabilities"][0]),
|
||||||
|
},
|
||||||
|
|
||||||
&framework.Path{
|
&framework.Path{
|
||||||
Pattern: "rekey/backup$",
|
Pattern: "rekey/backup$",
|
||||||
|
|||||||
Reference in New Issue
Block a user