jwt

package
v0.0.0-...-b66827d Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorreasonServerbusy   = "服务器繁忙"
	ErrorreasonLoginOutTime = "登录过期,请重新登录"
)

Variables

View Source
var (
	Secret     string // 加盐
	ExpireTime int    // token有效期
	Issuer     string
	Subject    string
)

Functions

func CheckLoin

func CheckLoin(strToken string) error

Types

type JWTAuth

type JWTAuth struct {
}

func (JWTAuth) CreateClaims

func (JWTAuth) CreateClaims(data interface{}) (claims *JWTClaims)

func (*JWTAuth) CreateToken

func (j *JWTAuth) CreateToken(data interface{}) (token string, err error)

func (JWTAuth) GetToken

func (JWTAuth) GetToken(claims *JWTClaims) (signedToken string, err error)

func (JWTAuth) Parse

func (JWTAuth) Parse(strToken string) (claims *JWTClaims, err error)

func (*JWTAuth) Refresh

func (j *JWTAuth) Refresh(token string) (newToken string, err error)

type JWTClaims

type JWTClaims struct {
	jwt.StandardClaims
	UserInfo UserInfo `json:"user_info"`
}

type UserInfo

type UserInfo struct {
	DataInfo interface{}
}

Jump to

Keyboard shortcuts

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