2023-03-15 16:00:52 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2015-03-04 07:34:32 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
2015-03-30 17:55:41 +00:00
|
|
|
|
2017-09-08 01:56:39 +00:00
|
|
|
"github.com/mitchellh/cli"
|
2015-03-04 07:34:32 +00:00
|
|
|
)
|
|
|
|
|
2017-09-08 01:56:39 +00:00
|
|
|
var _ cli.Command = (*AuthCommand)(nil)
|
2015-04-06 03:50:18 +00:00
|
|
|
|
2015-03-04 07:34:32 +00:00
|
|
|
type AuthCommand struct {
|
2017-09-05 03:59:24 +00:00
|
|
|
*BaseCommand
|
2015-03-04 07:34:32 +00:00
|
|
|
}
|
|
|
|
|
2017-09-05 03:59:24 +00:00
|
|
|
func (c *AuthCommand) Synopsis() string {
|
2017-09-08 01:56:39 +00:00
|
|
|
return "Interact with auth methods"
|
2017-09-05 03:59:24 +00:00
|
|
|
}
|
2015-03-04 07:34:32 +00:00
|
|
|
|
2017-09-05 03:59:24 +00:00
|
|
|
func (c *AuthCommand) Help() string {
|
2017-09-08 01:56:39 +00:00
|
|
|
return strings.TrimSpace(`
|
|
|
|
Usage: vault auth <subcommand> [options] [args]
|
2015-05-21 02:43:47 +00:00
|
|
|
|
2017-09-08 01:56:39 +00:00
|
|
|
This command groups subcommands for interacting with Vault's auth methods.
|
|
|
|
Users can list, enable, disable, and get help for different auth methods.
|
2015-05-23 18:22:35 +00:00
|
|
|
|
2017-09-08 01:56:39 +00:00
|
|
|
To authenticate to Vault as a user or machine, use the "vault login" command
|
|
|
|
instead. This command is for interacting with the auth methods themselves, not
|
|
|
|
authenticating to Vault.
|
2015-05-21 02:43:47 +00:00
|
|
|
|
2017-09-08 01:56:39 +00:00
|
|
|
List all enabled auth methods:
|
2015-03-30 17:55:41 +00:00
|
|
|
|
2017-09-08 01:56:39 +00:00
|
|
|
$ vault auth list
|
2016-09-08 15:14:47 +00:00
|
|
|
|
2017-09-08 01:56:39 +00:00
|
|
|
Enable a new auth method "userpass";
|
2015-04-06 03:50:18 +00:00
|
|
|
|
2017-09-08 01:56:39 +00:00
|
|
|
$ vault auth enable userpass
|
2015-04-06 03:50:18 +00:00
|
|
|
|
2017-09-08 01:56:39 +00:00
|
|
|
Get detailed help information about how to authenticate to a particular auth
|
|
|
|
method:
|
2015-04-06 16:38:16 +00:00
|
|
|
|
2017-09-08 01:56:39 +00:00
|
|
|
$ vault auth help github
|
2015-06-18 20:48:04 +00:00
|
|
|
|
2017-09-08 01:56:39 +00:00
|
|
|
Please see the individual subcommand help for detailed usage information.
|
|
|
|
`)
|
2017-09-05 03:59:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *AuthCommand) Run(args []string) int {
|
2019-02-14 19:54:47 +00:00
|
|
|
return cli.RunResultHelp
|
2017-08-24 22:23:40 +00:00
|
|
|
}
|