Documentation ¶
Overview ¶
auth contains functions and abstractions for authenticating against a Vault instance. It is built to be extendable by providing an interface that is accepted by the client Login() function for easily adding additional forms of authentication not currently supported by the package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Types = map[string]func() Auth{ NewUserPassAuth().Name(): NewUserPassAuth, NewUserPassRadiusAuth().Name(): NewUserPassRadiusAuth, }
Types is a map of every authentication type's name to its associated factory function.
Functions ¶
func GetAuthNames ¶
func GetAuthNames() []string
GetAuthNames returns the name of every type of authentication currently supported by the auth package.
Types ¶
type Auth ¶
type Auth interface { Name() string GetData(map[string]*Detail) map[string]interface{} GetPath(map[string]*Detail) string AuthDetails() map[string]*Detail }
Auth represents a form of authenticating with a Vault instance. See UserPassAuth for an example of how to properly implement this interface.
func NewUserPassAuth ¶
func NewUserPassAuth() Auth
NewUserPassAuth returns a new UserPassAuth struct with the name and mount already configured.
func NewUserPassRadiusAuth ¶
func NewUserPassRadiusAuth() Auth
NewUserPassRadiusAuth returns a new UserPassAuth struct with the name and mount already configured for Radius.
type Detail ¶
Detail represents a piece of information given by the end-user and required for performing authentication.
type UserPassAuth ¶
type UserPassAuth struct {
// contains filtered or unexported fields
}
UserPassAuth represents a form of authentication that takes a username and password.
func (*UserPassAuth) AuthDetails ¶
func (u *UserPassAuth) AuthDetails() map[string]*Detail
AuthDetails returns a map of detail names to their respective auth.Detail struct. This is used by the ui package to automatically collect the necessary authentication details required for this authentication type from the end-user. For example, the UserPassAuth type asks for the username and password for logging in.
func (*UserPassAuth) GetData ¶
func (u *UserPassAuth) GetData(details map[string]*Detail) map[string]interface{}
GetData returns a map of JSON data that will be written to the path returned by GetPath.
func (*UserPassAuth) GetPath ¶
func (u *UserPassAuth) GetPath(details map[string]*Detail) string
GetPath returns the Vault path to write to for performing this type of authentication (i.e. auth/userpass/login/user).
func (*UserPassAuth) Name ¶
func (u *UserPassAuth) Name() string
Name returns the name of the authentication type. This is used when building a list of supported authentication types and should be a user friendly name.