Skip to content

Commit

Permalink
reintroduce flagMFA (#4223)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnayak committed Mar 30, 2018
1 parent 36d4ae9 commit c880834
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions command/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type BaseCommand struct {
flagFormat string
flagField string

flagMFA []string

tokenHelper token.TokenHelper

client *api.Client
Expand Down Expand Up @@ -109,6 +111,8 @@ func (c *BaseCommand) Client() (*api.Client, error) {
client.SetToken(token)
}

client.SetMFACreds(c.flagMFA)

c.client = client

return client, nil
Expand Down Expand Up @@ -257,6 +261,15 @@ func (c *BaseCommand) flagSet(bit FlagSetBit) *FlagSets {
"The TTL is specified as a numeric string with suffix like \"30s\" " +
"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 {
Expand Down

0 comments on commit c880834

Please sign in to comment.