jwt

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

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

Go to latest
Published: Jun 18, 2019 License: MIT Imports: 7 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 CreateToken

func CreateToken(claims JWTClaims) (string, error)

创建token

func JWTAuth

func JWTAuth() gin.HandlerFunc

JWT中间件

func RefreshToken

func RefreshToken(tokenString string) (string, error)

更新token

Types

type JWTClaims

type JWTClaims struct {
	ID    interface{} `bson:"_id"`
	Email string      `bson:"email"`
	//Phone 	string		`bson:"phone"`
	jwt.StandardClaims
}

func ParseToken

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

解析token

Jump to

Keyboard shortcuts

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