jwt

package
v0.0.0-...-a93d61e Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenExpireDuration = 2 * time.Hour
)

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(username string, userId int64) (aToken, rToken string, err error)

GenerateToken 生成token

func RefreshToken

func RefreshToken(aToken, rToken string) (newAToken, newRToken string, err error)

RefreshToken 刷新token

Types

type MyClaims

type MyClaims struct {
	jwt.StandardClaims
	UserId   int64  `json:"user_id"`
	Username string `json:"username"`
}

func ParseToken

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

ParseToken 解析token

Jump to

Keyboard shortcuts

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