Documentation ¶
Overview ¶
Package auth provides the interface and registry for authentication providers
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUserPoolNotFound is returned when a user pool does not exist ErrUserPoolNotFound = errors.New("user pool not found") // ErrUserNotFound is returned when a user does not exist ErrUserNotFound = errors.New("user not found") // ErrUserExists is returned when a user exists and there is a conflict ErrUserExists = errors.New("user with that username exists") // ErrUserDisabled is returned when a user is disabled ErrUserDisabled = errors.New("user disabled") // ErrPasswordExpired is returned when a user's password is expired ErrPasswordExpired = errors.New("password expired") )
Functions ¶
func RegisterProvider ¶
RegisterProvider makes a database provider available by the provided name. If RegisterProvider is called twice with the same name or if provider is nil, it panics.
Types ¶
type Provider ¶
type Provider interface { // AuthenticateUser authenticates the user and returns an AuthToken AuthenticateUser(username, password string) (keychain.AuthToken, error) // CreateUser creates a new user CreateUser(username, password string, attributes map[string]string, options ...types.StringMap) (User, error) // ChangeUserPassword attempts to change the users password from current to the proposed ChangeUserPassword(username, current, proposed string) error // GetUser returns a user GetUser(username string) (User, error) // UpdateUser updates a users attributes UpdateUser(username string, attributes types.StringMap) error // DeleteUser deletes a user record DeleteUser(username string) error // DisableUser disables a user account DisableUser(username string) error }
Provider is an interface for user providers
type User ¶
type User interface { // Login returns the user login i.e. username Login() string // Attributes returns a map of user attributes Attributes() types.StringMap // Status returns the user status as a string Status() string // Enabled represents the user's status Enabled() bool // Groups returns a list of groups the user belongs to Groups() []string }
User is a common user interface
Click to show internal directories.
Click to hide internal directories.