jwt

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	//加密秘钥
	Secret string

	//过期时间(单位:天)
	Expire int
}

type JwtAuth

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

func New

func New(cfg *Config) *JwtAuth

func (*JwtAuth) Auth

func (jwtAuth *JwtAuth) Auth(c *bm.Context)

校验JWT Token

func (*JwtAuth) GetToken

func (jwtAuth *JwtAuth) GetToken(userTitle *auth.UserTitle) (string, error)

生成JWT Token

type MapgooClaims

type MapgooClaims struct {
	UserTitle *auth.UserTitle       `json:"title,omitempty"`
	Claims    *jwt.RegisteredClaims `json:"claims,omitempty"`
}

func (*MapgooClaims) Valid

func (claims *MapgooClaims) Valid() error

Jump to

Keyboard shortcuts

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