jwt

package
v0.0.0-...-613ab89 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 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)

TODO verify if this ever returns any error, it shouldnt

func SetJWTTimeClaims

func SetJWTTimeClaims(claims *map[string]interface{}, 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]interface{}) (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