middleware

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: GPL-3.0 Imports: 17 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")
)

Functions

func ClientMiddleware

func ClientMiddleware(next endpoint.Endpoint) endpoint.Endpoint

ClientMiddleware client middleware print server address 、rpc timeout and connection timeout

func CommonMiddleware

func CommonMiddleware(next endpoint.Endpoint) endpoint.Endpoint

CommonMiddleware common middleware print some rpc info、real request and real response

func JWTAuth

func JWTAuth() app.HandlerFunc

func Recovery

func Recovery() app.HandlerFunc

func ServerMiddleware

func ServerMiddleware(next endpoint.Endpoint) endpoint.Endpoint

ServerMiddleware server middleware print client address

Types

type JWT

type JWT struct {
	SigningKey []byte
}

func NewJWT

func NewJWT() *JWT

func (*JWT) CreateToken

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

CreateToken to create a token

func (*JWT) ParseToken

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

ParseToken to parse a token

func (*JWT) RefreshToken

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

RefreshToken to refresh a token

Jump to

Keyboard shortcuts

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