jwtx

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CacheKey = "jwt:%v"

Variables

This section is empty.

Functions

func Gen

func Gen(cfg Config, claims DefinedClaims, uInfo any) (string, time.Time, error)

Gen 生成JWT token、失效时间

func VerifyRequest

func VerifyRequest(cfg Config, req *http.Request) (string, error)

VerifyRequest 验证

Types

type Config

type Config struct {
	Secret  string `mapstructure:"secret"`
	Expired int    `mapstructure:"expired"`
}

type DefinedClaims

type DefinedClaims struct {
	contextx.TraceUser
	jwt.StandardClaims
}

Jump to

Keyboard shortcuts

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