Documentation ¶
Overview ¶
Package auth implements the authentication functions for the server.
Index ¶
- func Authenticate(db db.DBContext, c echo.Context) (*models.User, error)
- func AuthenticateAdmin(c echo.Context) (bool, error)
- func CheckPassword(raw, hashed string) (bool, error)
- func GeneratePassword(count int) ([]string, error)
- func MustAdmin(h echo.HandlerFunc) echo.HandlerFunc
- func MustAuth(db *db.DB) echo.MiddlewareFunc
- func PasswordHash(raw string) ([]byte, error)
- func Remove(c echo.Context) error
- func RemoveAdmin(c echo.Context) error
- func SaveAdmin(key string, c echo.Context) error
- func Store(u *models.User, timeout time.Duration, c echo.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
Authenticate tries to resolve an authentication from the context. Might return a nil user with a nil error.
func AuthenticateAdmin ¶
AuthenticateAdmin returns whether the context has admin panel access.
func CheckPassword ¶
CheckPassword returns whether the raw password matches the hashed password.
func GeneratePassword ¶
GeneratePassword generates random hex passwords of length 8.
func MustAdmin ¶
func MustAdmin(h echo.HandlerFunc) echo.HandlerFunc
MustAdmin is a middleware that ensures admin access.
func MustAuth ¶
MustAuth returns the middleware that redirects to /login if authentication is not found.
func PasswordHash ¶
PasswordHash hashes a raw string into a hashed password.
func RemoveAdmin ¶
func RemoveAdmin(c echo.Context) error
RemoveAdmin removes the admin cookie session.
Types ¶
This section is empty.