Documentation ¶
Overview ¶
Package accounts ...
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrAccountNotFound is returned when an account is not found. ErrAccountNotFound = errors.New("account not found") // ErrIncorrectPassword is returned when the password is invalid. ErrIncorrectPassword = errors.New("incorrect password") // ErrInsufficientCapabilities is returned when the account does not have the required capabilities. ErrInsufficientCapabilities = errors.New("insufficient capabilities") // ErrAccountDisabled is returned when the account is disabled. ErrAccountDisabled = errors.New("account disabled") // ErrUserAlreadyExists is returned when we try to create a user that already exists. ErrUserAlreadyExists = errors.New("user already exists") )
Functions ¶
Types ¶
type Account ¶
type Account struct { Enabled bool `yaml:"enabled"` Capabilities []AccountCapability `yaml:"capabilities"` PasswordMtime string `yaml:"passwordMtime"` PasswordHash string `yaml:"passwordHash"` }
Account is an internal representation of an Everest user account.
func (Account) HasCapability ¶
func (a Account) HasCapability(c AccountCapability) bool
HasCapability returns true if the given account has the specified capability.
type AccountCapability ¶
type AccountCapability string
AccountCapability represents a capability of an account.
const ( // AccountCapabilityLogin represents capability to create UI session tokens. AccountCapabilityLogin AccountCapability = "login" // AccountCapabilityAPIKey represents capability to generate API auth tokens. AccountCapabilityAPIKey AccountCapability = "apiKey" )
type Interface ¶
type Interface interface { Create(ctx context.Context, username, password string) error Get(ctx context.Context, username string) (*Account, error) List(ctx context.Context) (map[string]*Account, error) Delete(ctx context.Context, username string) error SetPassword(ctx context.Context, username, newPassword string, secure bool) error Verify(ctx context.Context, username, password string) error IsSecure(ctx context.Context, username string) (bool, error) }
Interface provides the methods for managing Everest user accounts.
Click to show internal directories.
Click to hide internal directories.