middleware

package
v0.0.0-...-20002e4 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenExpired     = errors.New("token is expired")
	ErrTokenNotValidYet = errors.New("token not active yet")
	ErrTokenMalformed   = errors.New("that's not even a token")
	ErrTokenInvalid     = 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