auth

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2020 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package auth implements the authentication functions for the server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(db db.DBContext, c echo.Context) (*models.User, error)

Authenticate tries to resolve an authentication from the context. Might return a nil user with a nil error.

func AuthenticateAdmin

func AuthenticateAdmin(c echo.Context) (bool, error)

AuthenticateAdmin returns whether the context has admin panel access.

func CheckPassword

func CheckPassword(raw, hashed string) (bool, error)

CheckPassword returns whether the raw password matches the hashed password.

func MustAdmin

func MustAdmin(h echo.HandlerFunc) echo.HandlerFunc

MustAdmin is a middleware that ensures admin access.

func MustAuth

func MustAuth(db *db.DB) echo.MiddlewareFunc

MustAuth returns the middleware that redirects to /login if authentication is not found.

func PasswordHash

func PasswordHash(raw string) ([]byte, error)

PasswordHash hashes a raw string into a hashed password.

func Remove

func Remove(c echo.Context) error

Remove removes the authentication cookie.

func RemoveAdmin

func RemoveAdmin(c echo.Context) error

RemoveAdmin removes the admin cookie session.

func SaveAdmin

func SaveAdmin(key string, c echo.Context) error

SaveAdmin saves the admin cookie.

func Store

func Store(u *models.User, timeout time.Duration, c echo.Context) error

Store stores the user as a cookie.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL