jwt

package
v0.0.0-...-6cf1638 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MulanPSL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserSecretKey = []byte("Easy-Pass-JWT")

Functions

func GenerateAppToken

func GenerateAppToken(accessKey string, secretKey []byte, qps, qpd int64) (string, error)

GenerateAppToken 签发用户Token

func GenerateUserToken

func GenerateUserToken(userID int, userName string) (string, error)

GenerateUserToken 签发用户Token

Types

type AppClaims

type AppClaims struct {
	AccessKey string `json:"accessKey"`
	Qps       int64  `json:"qps"`
	Qpd       int64  `json:"qpd"`
	jwt.StandardClaims
}

func ParseAppToken

func ParseAppToken(tokenString string, secretKey []byte) (*AppClaims, error)

ParseAppToken 验证用户token

func ParseUnverified

func ParseUnverified(token string) (*AppClaims, error)

ParseUnverified 解析 Token 不验证

type UserClaims

type UserClaims struct {
	UserID   int    `json:"userId"`
	UserName string `json:"userName"`
	jwt.StandardClaims
}

func ParseUserToken

func ParseUserToken(tokenString string) (*UserClaims, error)

ParseUserToken 验证用户token

Jump to

Keyboard shortcuts

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