jwt

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JWTKey           = []byte("go-cdt-wdx")
	JWTTokenDuration = 300
	JWTIssuer        = "wdxtub"
)

加密的密钥

Functions

func GenerateWeappToken

func GenerateWeappToken(openID, sessionKey string, accountID int) (string, error)

GenerateWeappToken 根据微信的返回生成对应的 token

func GenerateWebToken

func GenerateWebToken(id int, role string) (string, error)

GenerateWebToken 生成 web 端 token

Types

type IdentityClaims

type IdentityClaims struct {
	AccountOpenID string `json:"account_openid"`
	AccountID     int    `json:"account_id"`
	AccountRole   string `json:"account_role"`
	SessionKey    string `json:"session_key"`
	jwt.StandardClaims
}

IdentityClaims 用户的 JWT KEY

func ParseToken

func ParseToken(tokenString string) (*IdentityClaims, error)

ParseToken 验证是否是有效的 Token

Jump to

Keyboard shortcuts

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