jwt

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(username string) (string, error)

生成token

func GetIdFromClaims

func GetIdFromClaims(key string, claims jwt.Claims) string

根据 token 获取用户名

func JWT

func JWT(r *ghttp.Request)

func JwtSecret

func JwtSecret() []byte

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	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