middleware

package
v0.0.0-...-4e954e8 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func GetSignKey

func GetSignKey() string

GetSignKey 获取token

func JWTAuth

func JWTAuth() gin.HandlerFunc

JWTAuth ...

func Logger

func Logger() gin.HandlerFunc

Logger ...

func SetSignKey

func SetSignKey(key string) string

SetSignKey 这是SignKey

Types

type CustomClaims

type CustomClaims struct {
	UUID        uuid.UUID
	ID          uint
	NickName    string
	AuthorityID string
	jwt.StandardClaims
}

CustomClaims ...

type JWT

type JWT struct {
	SigningKey []byte
}

JWT ...

func NewJWT

func NewJWT() *JWT

NewJWT ...

func (*JWT) CreateToken

func (j *JWT) CreateToken(claims CustomClaims) (string, error)

CreateToken 创建一个token

func (*JWT) ParseToken

func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)

ParseToken ...

func (*JWT) RefreshToken

func (j *JWT) RefreshToken(tokenString string) (string, error)

RefreshToken ...

type SQLRes

type SQLRes struct {
	Path        string
	AuthorityID string
	APIID       uint
	ID          uint
}

SQLRes ...

Jump to

Keyboard shortcuts

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