mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-11 07:16:28 +02:00
Add -no-verify option to CLI auth command, to avoid decrementing the token use count during auth.
This commit is contained in:
parent
83678064d0
commit
1f0458ffd5
@ -34,10 +34,11 @@ type AuthCommand struct {
|
||||
|
||||
func (c *AuthCommand) Run(args []string) int {
|
||||
var method string
|
||||
var methods, methodHelp bool
|
||||
var methods, methodHelp, noVerify bool
|
||||
flags := c.Meta.FlagSet("auth", FlagSetDefault)
|
||||
flags.BoolVar(&methods, "methods", false, "")
|
||||
flags.BoolVar(&methodHelp, "method-help", false, "")
|
||||
flags.BoolVar(&noVerify, "no-verify", false, "")
|
||||
flags.StringVar(&method, "method", "", "method")
|
||||
flags.Usage = func() { c.Ui.Error(c.Help()) }
|
||||
if err := flags.Parse(args); err != nil {
|
||||
@ -170,6 +171,14 @@ func (c *AuthCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
if noVerify {
|
||||
c.Ui.Output(fmt.Sprintf(
|
||||
"Authenticated - no token verification has been performed.",
|
||||
))
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// Verify the token
|
||||
secret, err := client.Logical().Read("auth/token/lookup-self")
|
||||
if err != nil {
|
||||
@ -273,6 +282,9 @@ Auth Options:
|
||||
|
||||
-methods List the available auth methods.
|
||||
|
||||
-no-verify Do not verify the token after creation; avoids a use count
|
||||
decrement.
|
||||
|
||||
`
|
||||
return strings.TrimSpace(helpText)
|
||||
}
|
||||
|
||||
@ -75,10 +75,6 @@ func NewTokenStore(c *Core) (*TokenStore, error) {
|
||||
Root: []string{
|
||||
"revoke-prefix/*",
|
||||
},
|
||||
|
||||
Unauthenticated: []string{
|
||||
"lookup-self",
|
||||
},
|
||||
},
|
||||
|
||||
Paths: []*framework.Path{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user