Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reintroduce flag 'MFA' #4223

Merged
merged 2 commits into from
Mar 30, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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