Merge pull request #1532 from hashicorp/vault-auth-path
Added -path option to 'vault auth' command
This commit is contained in:
commit
949bb97ebc
|
@ -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:
|
||||
|
||||
|
@ -320,6 +329,9 @@ Auth Options:
|
|||
-no-verify Do not verify the token after creation; avoids a use count
|
||||
decrement.
|
||||
|
||||
-path The path at which the auth backend is enabled. If an auth
|
||||
backend is mounted at multiple paths, this option can be
|
||||
used to authenticate against specific paths.
|
||||
`
|
||||
return strings.TrimSpace(helpText)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue