mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
reintroduce flagMFA (#4223)
This commit is contained in:
@@ -43,6 +43,8 @@ type BaseCommand struct {
|
|||||||
flagFormat string
|
flagFormat string
|
||||||
flagField string
|
flagField string
|
||||||
|
|
||||||
|
flagMFA []string
|
||||||
|
|
||||||
tokenHelper token.TokenHelper
|
tokenHelper token.TokenHelper
|
||||||
|
|
||||||
client *api.Client
|
client *api.Client
|
||||||
@@ -109,6 +111,8 @@ func (c *BaseCommand) Client() (*api.Client, error) {
|
|||||||
client.SetToken(token)
|
client.SetToken(token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.SetMFACreds(c.flagMFA)
|
||||||
|
|
||||||
c.client = client
|
c.client = client
|
||||||
|
|
||||||
return client, nil
|
return client, nil
|
||||||
@@ -257,6 +261,15 @@ func (c *BaseCommand) flagSet(bit FlagSetBit) *FlagSets {
|
|||||||
"The TTL is specified as a numeric string with suffix like \"30s\" " +
|
"The TTL is specified as a numeric string with suffix like \"30s\" " +
|
||||||
"or \"5m\".",
|
"or \"5m\".",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
f.StringSliceVar(&StringSliceVar{
|
||||||
|
Name: "mfa",
|
||||||
|
Target: &c.flagMFA,
|
||||||
|
Default: nil,
|
||||||
|
EnvVar: api.EnvVaultMFA,
|
||||||
|
Completion: complete.PredictAnything,
|
||||||
|
Usage: "Supply MFA credentials as part of X-Vault-MFA header.",
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if bit&(FlagSetOutputField|FlagSetOutputFormat) != 0 {
|
if bit&(FlagSetOutputField|FlagSetOutputFormat) != 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user