middleware

package
v0.0.0-...-ac058c7 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrivateMiddleware

func PrivateMiddleware(passcode string) gin.HandlerFunc

func ProtectedMiddleWare

func ProtectedMiddleWare(extractionKey string, accessKey string, validateToken Validate, sugarLogger *zap.SugaredLogger) gin.HandlerFunc

func PublicMiddleWare

func PublicMiddleWare(extractionKey string, restKey string, validateToken PublicValidate, sugarLogger *zap.SugaredLogger) gin.HandlerFunc

Types

type HandleMiddleWare

type HandleMiddleWare func(ctx *gin.Context)

type JwtClaim

type JwtClaim struct {
	UserID      int64
	DeviceID    string
	IdentityKey string
	jwt.StandardClaims
}

type MiddlewareType

type MiddlewareType string
const (
	Protected MiddlewareType = "protected"
	Public    MiddlewareType = "public"
	Private   MiddlewareType = "private"
)

type MiddlewareValue

type MiddlewareValue struct {
	MiddlewareType MiddlewareType
	UserID         int64
	DeviceID       string
	IdentityKey    string
}

func (*MiddlewareValue) GetMiddlewareValue

func (mv *MiddlewareValue) GetMiddlewareValue(ctx *gin.Context) rest_errors.RestError

type PublicClaim

type PublicClaim struct {
	Key string
	jwt.RegisteredClaims
}

type PublicValidate

type PublicValidate func(token string, secret string) (*PublicClaim, rest_errors.RestError)

type Validate

type Validate func(token string, secret string) (*JwtClaim, rest_errors.RestError)

Jump to

Keyboard shortcuts

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