middleware

package
v0.0.0-...-867eee7 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PcJwtHandler = jwtmiddleware.New(jwtmiddleware.Config{
	ValidationKeyGetter: func(token *jwt.Token) (interface{}, error) {
		return []byte(conf.Conf.AppSecret), nil
	},

	SigningMethod: jwt.SigningMethodHS256,
	ErrorHandler: func(ctx iris.Context, err error) {
		ctx.StatusCode(iris.StatusUnauthorized)
		ctx.JSON(map[string]interface{}{
			"success": false,
			"message": "jwt token check error: " + err.Error(),
			"code":    iris.StatusUnauthorized,
		})
		debug.PrintStack()
	},
})

Functions

func NewJwtToken

func NewJwtToken(expireIn time.Duration, info map[string]interface{}) (string, error)

func ParseToken

func ParseToken(token string) (claim jwt.MapClaims, err error)

func PcJwtAuth

func PcJwtAuth(ctx iris.Context)

校验pc端jwt

Types

type PcLoginInfo

type PcLoginInfo struct {
	// contains filtered or unexported fields
}

func ContextLoginInfo

func ContextLoginInfo(ctx iris.Context) *PcLoginInfo

func (*PcLoginInfo) Uk

func (p *PcLoginInfo) Uk() string

func (*PcLoginInfo) User

func (p *PcLoginInfo) User() *dao.UserModel

Jump to

Keyboard shortcuts

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