jwt

package
v0.0.0-...-35d01cd Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var Secret = []byte(conf.C.JWT.Secret)

Functions

func GenReToken

func GenReToken(userID uint, username string) (string, error)

func GenToken

func GenToken(userID uint, username string) (string, error)

func JWTAuth

func JWTAuth(h engine.Handle) engine.Handle

Types

type Claims

type Claims struct {
	UserID         uint   `json:"user_id"`
	Username       string `json:"username"`
	IsRefreshToken bool   `json:"is_refresh_token"`
	jwt.RegisteredClaims
}

func ParseToken

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

Jump to

Keyboard shortcuts

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