auth

package
v0.0.0-...-ea88d16 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(conf *Conf) gin.HandlerFunc

Auth - main auth func

func HashPassword

func HashPassword(pw string) string

HashPassword - generate hash from password

func LogOut

func LogOut(c *gin.Context)

LogOut - log out

func MatchPasswords

func MatchPasswords(hash, pw string) bool

MatchPasswords - check if password and hash matches

func StartSession

func StartSession(c *gin.Context)

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