auth

package
v0.0.0-...-ae2eaf7 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(next http.HandlerFunc, conf *Conf) http.HandlerFunc

Auth - main auth func

func HashPassword

func HashPassword(pw string) string

HashPassword - generate hash from password

func LogOut

func LogOut(w http.ResponseWriter, r *http.Request)

LogOut - log out

func MatchPasswords

func MatchPasswords(hash, pw string) bool

MatchPasswords - check if password and hash matches

func StartSession

func StartSession(w http.ResponseWriter, r *http.Request)

StartSession for new login

func ToTime

func ToTime(s string) time.Duration

ToTime - converts string (example: 3d) to time.Duration

Types

type Conf

type Conf struct {
	Auth     bool
	User     string
	Password string
	ExpStr   string
	Expire   time.Duration
}

Conf - auth config

Jump to

Keyboard shortcuts

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