middleware

package
v0.0.0-...-f70a1fa Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(authFace AuthFace, hFunc func() hash.Hash) app.HandlerFunc

func CasbinHandler

func CasbinHandler(casbinFace CasbinFace, log hlog.CtxLogger) app.HandlerFunc

func Cors

func Cors() app.HandlerFunc

func GetSigned

func GetSigned(ak, sk, path string, t int64, hFunc func() hash.Hash) string

func RegisterLocation

func RegisterLocation(locationFace LocationFace) app.HandlerFunc

Types

type AuthFace

type AuthFace interface {
	GetSk(context context.Context, ctx *app.RequestContext,
		ak string, timestamp int64) (context.Context, string, error)
}

type CasbinFace

type CasbinFace interface {
	Enforce(ctx context.Context,
		roleID int64, path string, method string) (bool, error)
	GetRoleID(ctx *app.RequestContext) int64
}

type LocationFace

type LocationFace interface {
	RegisterClientIp(c context.Context,
		ctx *app.RequestContext) (context.Context, error)
}

Jump to

Keyboard shortcuts

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