jwt

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

JSON WEB TOKEN 层

Index

Constants

View Source
const (
	ERROR_AUTH_TOKEN = 40006
)

内置异常

Variables

View Source
var TOKEN_ERROR = map[int]string{
	ERROR_AUTH_TOKEN: "Token生成失败",
}

Functions

func GenerateToken

func GenerateToken(gmUser model.GmUserModel) (string, error)

生成token

Types

type Claims

type Claims struct {
	ID       int32  `json:"id"`
	Username string `json:"username"`
	RoleId   int32  `json:"role_id"`
	jwt.StandardClaims
}

func ParseToken

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

解析token

Jump to

Keyboard shortcuts

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