2023-03-15 12:00:52 -04:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-10 21:14:03 -04:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-15 12:00:52 -04:00
|
|
|
|
2015-03-04 02:34:32 -05:00
|
|
|
package command
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
2015-03-30 13:55:41 -04:00
|
|
|
|
2023-12-04 14:05:02 -05:00
|
|
|
"github.com/hashicorp/cli"
|
2015-03-04 02:34:32 -05:00
|
|
|
)
|
|
|
|
|
|
2017-09-07 21:56:39 -04:00
|
|
|
var _ cli.Command = (*AuthCommand)(nil)
|
2015-04-05 23:50:18 -04:00
|
|
|
|
2015-03-04 02:34:32 -05:00
|
|
|
type AuthCommand struct {
|
2017-09-04 23:59:24 -04:00
|
|
|
*BaseCommand
|
2015-03-04 02:34:32 -05:00
|
|
|
}
|
|
|
|
|
|
2017-09-04 23:59:24 -04:00
|
|
|
func (c *AuthCommand) Synopsis() string {
|
2017-09-07 21:56:39 -04:00
|
|
|
return "Interact with auth methods"
|
2017-09-04 23:59:24 -04:00
|
|
|
}
|
2015-03-04 02:34:32 -05:00
|
|
|
|
2017-09-04 23:59:24 -04:00
|
|
|
func (c *AuthCommand) Help() string {
|
2017-09-07 21:56:39 -04:00
|
|
|
return strings.TrimSpace(`
|
|
|
|
|
Usage: vault auth <subcommand> [options] [args]
|
2015-05-20 22:43:47 -04:00
|
|
|
|
2017-09-07 21:56:39 -04: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 14:22:35 -04:00
|
|
|
|
2017-09-07 21:56:39 -04: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-20 22:43:47 -04:00
|
|
|
|
2017-09-07 21:56:39 -04:00
|
|
|
List all enabled auth methods:
|
2015-03-30 13:55:41 -04:00
|
|
|
|
2017-09-07 21:56:39 -04:00
|
|
|
$ vault auth list
|
2016-09-08 11:14:47 -04:00
|
|
|
|
2017-09-07 21:56:39 -04:00
|
|
|
Enable a new auth method "userpass";
|
2015-04-05 23:50:18 -04:00
|
|
|
|
2017-09-07 21:56:39 -04:00
|
|
|
$ vault auth enable userpass
|
2015-04-05 23:50:18 -04:00
|
|
|
|
2017-09-07 21:56:39 -04:00
|
|
|
Get detailed help information about how to authenticate to a particular auth
|
|
|
|
|
method:
|
2015-04-06 12:38:16 -04:00
|
|
|
|
2017-09-07 21:56:39 -04:00
|
|
|
$ vault auth help github
|
2015-06-18 16:48:04 -04:00
|
|
|
|
2017-09-07 21:56:39 -04:00
|
|
|
Please see the individual subcommand help for detailed usage information.
|
|
|
|
|
`)
|
2017-09-04 23:59:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *AuthCommand) Run(args []string) int {
|
2019-02-14 14:54:47 -05:00
|
|
|
return cli.RunResultHelp
|
2017-08-24 18:23:40 -04:00
|
|
|
}
|