Added '-path' option to 'vault auth' command

This commit is contained in:
vishalnayak
2016-06-15 16:45:07 -04:00
parent d232de6225
commit 7672d69495

View File

@@ -35,13 +35,14 @@ type AuthCommand struct {
}
func (c *AuthCommand) Run(args []string) int {
var method string
var method, authPath string
var methods, methodHelp, noVerify bool
flags := c.Meta.FlagSet("auth", meta.FlagSetDefault)
flags.BoolVar(&methods, "methods", false, "")
flags.BoolVar(&methodHelp, "method-help", false, "")
flags.BoolVar(&noVerify, "no-verify", false, "")
flags.StringVar(&method, "method", "", "method")
flags.StringVar(&authPath, "path", "", "")
flags.Usage = func() { c.Ui.Error(c.Help()) }
if err := flags.Parse(args); err != nil {
return 1
@@ -148,6 +149,10 @@ func (c *AuthCommand) Run(args []string) int {
return 1
}
if authPath != "" {
vars["mount"] = authPath
}
// Authenticate
token, err := handler.Auth(client, vars)
if err != nil {
@@ -298,10 +303,14 @@ Usage: vault auth [options] [token or config...]
"vault write". Specify the "-method-help" flag to get help for a specific
method.
If you've mounted a credential backend to a different path, such
as mounting "github" to "github-private", the "method" flag should
still be "github." Most credential providers support the "mount" option
to specify the mount point. See the "-method-help" for more info.
If an auth backend is enabled at a different path, such as enabling
"github" at "github-private", the "method" flag should still be "github".
The flag "-path" should be used to specify the path at which the auth
backend is enabled. For example:
"vault auth -method=github -path=github-private token=<github_token>"
The value of the "path" flag will be supplied to auth providers
as the "mount" option in the payload to specify the mount point.
See the "-method-help" for more info.
General Options: