jwt

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const TokenExpireDuration = time.Hour * 2

token的过期时长

Variables

View Source
var MySecret = []byte("bryant-rh")

secret,签名时使用

Functions

func GenToken

func GenToken(username, password string) (string, error)

创建token

Types

type MyClaims

type MyClaims struct {
	Username string `json:"username"`
	Password string `json:"password"`
	jwt.StandardClaims
}

用来生成token的struct

func ParseToken

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

解析token

Jump to

Keyboard shortcuts

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