jwt

package
v0.0.0-...-ff2cee6 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticatorIsAdmin

func AuthenticatorIsAdmin(next http.Handler) http.Handler

AuthenticatorIsAdmin is a middleware for checking user's admin privilege.

func AuthenticatorIsLoggedIn

func AuthenticatorIsLoggedIn(next http.Handler) http.Handler

func GetUserID

func GetUserID(context context.Context) int

func GetUsername

func GetUsername(context context.Context) (string, error)

func SetJWTTimeClaims

func SetJWTTimeClaims(claims *map[string]any, expireIn time.Duration)

SetJWTTimeClaims is a workaround for setting exp and iat (that should be done at creation time).

Types

type JWTObject

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

func NewJWT

func NewJWT(secret string) JWTObject

func (JWTObject) Encode

func (j JWTObject) Encode(claims map[string]any) (jwt.Token, string, error)

func (JWTObject) Verifier

func (j JWTObject) Verifier() func(http.Handler) http.Handler

Verifier is just here to limit external imports in api

Jump to

Keyboard shortcuts

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