Documentation ¶
Index ¶
- Variables
- func RegisterAPI(opts Options) http.Handler
- type Details
- type Options
- type Registry
- func (u *Registry) BcryptChecker() common.PasswordChecker
- func (u *Registry) Delete(username string) error
- func (u *Registry) Get(username string) (*Details, error)
- func (u *Registry) LoadFromJSON(r io.Reader) error
- func (u *Registry) PlainTextChecker() common.PasswordChecker
- func (u *Registry) Put(user *Details) error
- func (u *Registry) SaveToJSON(w io.Writer) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidUser = errors.New("invalid user")
)
Common Errors
Functions ¶
func RegisterAPI ¶
RegisterAPI returns a router for the api.
Types ¶
type Details ¶
type Details struct { ID int `json:"id"` Username string `json:"username"` Password string `json:"password"` Email string `json:"email"` Name string `json:"name"` State string `json:"state"` }
Details describes the user details
type Registry ¶ added in v0.0.7
type Registry struct {
// contains filtered or unexported fields
}
Registry maintains the known users
func NewRegistry ¶ added in v0.0.7
NewRegistry returns an initialized UserRegistry
func (*Registry) BcryptChecker ¶ added in v0.0.7
func (u *Registry) BcryptChecker() common.PasswordChecker
BcryptChecker creates in implementation of common.Checker that uses bcrypt to verify password against the password field in the user details
func (*Registry) Get ¶ added in v0.0.7
Get returns a user registration by username, or an error if not found
func (*Registry) LoadFromJSON ¶ added in v0.0.7
LoadFromJSON loads users encoded in JSON
func (*Registry) PlainTextChecker ¶ added in v0.0.7
func (u *Registry) PlainTextChecker() common.PasswordChecker
PlainTextChecker creates in implementation of common.Checker that uses simple text comparison to verify password against the plain text password field in the user details
Click to show internal directories.
Click to hide internal directories.