Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidCredentials = errors.New("invalid credentials")
Functions ¶
func NewBasicAuth ¶
func NewBasicAuth(userDatabase UsersDatabase) *basicAuthContext
func NewSimpleAuth ¶
func NewSimpleAuth(userDatabase UsersDatabase) *simpleAuthContext
Types ¶
type User ¶
type User struct { Username string `json:"username" yaml:"-"` Email string `json:"email" yaml:"email"` Name string `json:"name" yaml:"name"` Password string `json:"-" yaml:"password"` }
func UserFromContext ¶
type UsersDatabase ¶
type UsersDatabase struct { Users map[string]*User `yaml:"users"` LastRead time.Time `yaml:"-"` LastSave time.Time `yaml:"-"` Path string `yaml:"-"` }
func ReadUsersFromFile ¶
func ReadUsersFromFile(path string) (UsersDatabase, error)
func (*UsersDatabase) Find ¶
func (u *UsersDatabase) Find(username string) *User
func (*UsersDatabase) FindByPassword ¶
func (u *UsersDatabase) FindByPassword(username, password string) *User
Click to show internal directories.
Click to hide internal directories.