Documentation ¶
Overview ¶
Package auth provides common code for handling user authentication in a rather implementation agnostic way. Currently, we only provide basic auth backed by a CSV, but most components contain an interface that _should_ make it rather easy to swap out implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrUnauthorized is returned when no user information is found on a context.
Functions ¶
Types ¶
type Config ¶
type Config struct {
AuthType string `json:"auth_type" usage:"configure the user authentication type to use"`
}
Config defines a general configuration structure used configure which authentication is enabled.
type HandlerFunc ¶
HandlerFunc defines a common way to add authentication / authorization to a Golang context.
func Composite ¶
func Composite(handlers ...HandlerFunc) HandlerFunc
Composite returns a HandlerFunc that iterates all provided HandlerFunc until the end or an error occurs.
func Required ¶
func Required() HandlerFunc
Required returns a HandlerFunc that ensures user information is present on the context.
type UserInfo ¶
type UserInfo struct { // Subject is the users ID. CACF1875-7B44-4B77-BF52-51A06E52FFDF Subject string `json:"sub"` // Profile is the users name. "Jane Doe" Profile string `json:"profile"` // Email is the users' email address. jane@example.com Email string `json:"email"` // EmailVerified indicates if the user has verified their email address. EmailVerified bool `json:"email_verified"` // Groups contains a list of groups that the user belongs to. Groups []string `json:"groups"` // contains filtered or unexported fields }
UserInfo represents a minimum set of user information.
func (*UserInfo) UnmarshalJSON ¶
UnmarshalJSON transparently unmarshals the user information structure.