Documentation ¶
Index ¶
- Variables
- func Basic(store Store) auth.HandlerFunc
- func Bearer(store Store) auth.HandlerFunc
- func Handler(ctx context.Context, cfg Config) (auth.HandlerFunc, error)
- func Static(username, password string, groups ...string) auth.HandlerFunc
- type AccessToken
- type ClientConfig
- type Config
- type LazyStore
- type LookupRequest
- type LookupResponse
- type Store
- type UsernamePassword
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBadRequest = errors.New("bad lookup request")
ErrBadRequest is returned when a lookup request does not contain a required field.
View Source
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a credential is not found.
Functions ¶
func Basic ¶
func Basic(store Store) auth.HandlerFunc
Basic implements a basic access authentication handler function.
func Bearer ¶
func Bearer(store Store) auth.HandlerFunc
Bearer returns a handler func that translates bearer tokens into user information.
Types ¶
type AccessToken ¶
type AccessToken struct {
Token string `json:"token" usage:"the access token used to authenticate requests"`
}
AccessToken is used to authenticate a user using a bearer token.
type ClientConfig ¶
type ClientConfig struct { UsernamePassword AccessToken }
ClientConfig defines the options available to a client.
type Config ¶
type Config struct { PasswordFile string `json:"password_file" usage:"path to the csv file containing usernames and passwords"` TokenFile string `json:"token_file" usage:"path to the csv file containing tokens"` StaticUsername string `json:"static_username" usage:"provide a static username to authenticate the user" hidden:"true"` StaticPassword string `json:"static_password" usage:"provide a static password to authenticate the user" hidden:"true"` StaticGroups *cli.StringSlice `json:"static_groups" usage:"provide a static set of groups to assign to the user" hidden:"true"` }
Config defines the options available to a server.
type LazyStore ¶
LazyStore provides a convenient way to lazily load an underlying store.
func (*LazyStore) Lookup ¶
func (c *LazyStore) Lookup(req LookupRequest) (resp LookupResponse, err error)
type LookupRequest ¶
type LookupResponse ¶
type Store ¶
type Store interface { // Lookup retrieves the provided user's password and groups. Lookup(req LookupRequest) (resp LookupResponse, err error) }
Store defines an abstraction for loading user credentials.
type UsernamePassword ¶
type UsernamePassword struct { Username string `json:"username" usage:"the username to login with"` Password string `json:"password" usage:"the password associated with the username"` }
UsernamePassword is used to authenticate a user using a username and password.
Click to show internal directories.
Click to hide internal directories.