internal

package
v0.0.0-...-63db276 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Secret           string
	CookieName       string
	Port             int
	MaxAge           int
	LoginStopSeconds int
	Password         string
)

Functions

func CheckAuthHandler

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

CheckAuthHandler validate jwt in cookies, response 401 when invalid

func InitParams

func InitParams()

func LoginHandler

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

Types

type JWTManager

type JWTManager struct {
	// contains filtered or unexported fields
}

func NewJWTManager

func NewJWTManager(secretKey []byte, maxAge int) *JWTManager

func (*JWTManager) GenerateToken

func (jm *JWTManager) GenerateToken(uid string) string

func (*JWTManager) Valid

func (jm *JWTManager) Valid(tokenString string, uid string) (bool, error)

Jump to

Keyboard shortcuts

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