jwt

package
v0.0.0-...-3e386e2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenExpired     error = errors.New("Token is expired")
	TokenNotValidYet error = errors.New("Token not active yet")
	TokenMalformed   error = errors.New("That's not even a token")
	TokenInvalid     error = errors.New("Couldn't handle this token:")
)

Functions

func Auth

func Auth() gin.HandlerFunc

Auth 中间件,检查token

func GenerateToken

func GenerateToken(claims CustomClaims) (string, error)

生成token

Types

type CustomClaims

type CustomClaims struct {
	Id       uint64 `json:"id"`
	Username string `json:"username"`
	Guard    string `json:"guard"`
	jwt.StandardClaims
}

func ParseToken

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

解析token

Jump to

Keyboard shortcuts

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