jwt

package
v0.0.0-...-dae3ebb Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// access token过期时间
	ATokenExpireDuration = time.Second * 1
	// refresh token过期时间
	RTokenExpireDuration = time.Second * 3
)

Variables

View Source
var Secret = []byte("亚索主E,QEQ")

密钥(盐)

Functions

func GenToken

func GenToken(userId int64) (aToken string, rToken string, err error)

生成jwt token

func ParseRefreshToken

func ParseRefreshToken(aToken, rToken string) (newAccessToken string, err error)

解析refresh token 并生成新的access token

Types

type Claims

type Claims struct {
	UserId int64 `json:"user_id"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(tokenString string) (claims *Claims, err error)

解析token

Jump to

Keyboard shortcuts

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