auth

package
v0.0.0-...-3e560f3 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const KEY_SIZE int = 24

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(next http.HandlerFunc) http.HandlerFunc

func GenerateCampaignKey

func GenerateCampaignKey() string

func GenerateJWT

func GenerateJWT(username string) (string, error)

GenerateJWT generates a new JWT token for a given username

func GetCurrentUsername

func GetCurrentUsername(r *http.Request) string

func IsAuthorized

func IsAuthorized(r *http.Request) bool

func ValidateUser

func ValidateUser(username, password string) bool

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	jwt.RegisteredClaims
}

Jump to

Keyboard shortcuts

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