jwt

package
v0.0.0-...-18974b4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigName = "jwt"

Variables

View Source
var (
	TokenInvalid = errors.New("couldn't handle this token")
	JWTConfig    *viper.Viper

	JWTUtil *JWT
)

Functions

This section is empty.

Types

type CustomClaims

type CustomClaims struct {
	UserId int64
	jwt.RegisteredClaims
}

type JWT

type JWT struct {
	SignKey []byte
}

func NewJWT

func NewJWT() *JWT

func (*JWT) CreateToken

func (j *JWT) CreateToken(userId int64) (string, error)

创建 token

func (*JWT) ParseToken

func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)

解析 token

Jump to

Keyboard shortcuts

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