jwt

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

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

Go to latest
Published: Dec 31, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success           = 0
	Unauthorized      = 401 //未有TOKEN
	AuthorizedExptime = 402 //过期
	AuthorizedFail    = 403 //校验失败
)

Variables

This section is empty.

Functions

func BackToken

func BackToken(tokenString string)

func GenToken

func GenToken(data interface{}, signKey string, expired int64) (string, error)

Types

type Resp

type Resp struct {
	Code int
	Msg  string
	Data interface{}
}

func AuthFail

func AuthFail(msg string) Resp

func Succ

func Succ(data interface{}) Resp

func SuccWithMsg

func SuccWithMsg(data interface{}, msg string) Resp

func UnauthFail

func UnauthFail(msg string, data interface{}) Resp

func (Resp) DataStrig

func (r Resp) DataStrig() string

func (Resp) MsgStr

func (r Resp) MsgStr() string

func (Resp) Succ

func (r Resp) Succ() bool

type TokenClaims

type TokenClaims struct {
	Payload            interface{} `json:"payload"`
	jwt.StandardClaims `json:"claims"`
}

func VaildToken

func VaildToken(tokenString string, signKey string) (*TokenClaims, error)

Jump to

Keyboard shortcuts

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