jwt

package
v0.0.0-...-8f4e997 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

本文件放置jwt的配置信息

Index

Constants

View Source
const (
	JWTSecret = "password_tik_duck"

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

Variables

View Source
var MySecret = []byte(JWTSecret) //nolint:gochecknoglobals

Functions

func GenToken

func GenToken(username string, id int64) (string, error)

生成jwt //目前是只进行记录用户名.

Types

type MyClaims

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

目前jwt的claims中 只记录了用户名一个信息.

func ParseToken

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

解析JWT.

Jump to

Keyboard shortcuts

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