middleware

package
v0.2.8-beta17 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package middleware @Link https://gitee.com/linngc/webos.gf @Copyright Copyright (c) 2022 webos CLI @Author linngc @License

Package middleware @Link https://gitee.com/linngc/webos.gf @Copyright Copyright (c) 2022 webos CLI @Author linngc @License

Package middleware @Link https://gitee.com/linngc/webos.gf @Copyright Copyright (c) 2022 webos CLI @Author linngc @License

Package middleware @Link https://gitee.com/linngc/webos.gf @Copyright Copyright (c) 2022 webos CLI @Author linngc @License

Package middleware @Link https://gitee.com/linngc/webos.gf @Copyright Copyright (c) 2022 webos CLI @Author linngc @License

Package middleware @Link https://gitee.com/linngc/webos.gf @Copyright Copyright (c) 2022 webos CLI @Author linngc @License

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAction

func RegisterAction(i IAction)

func RegisterBizCtx

func RegisterBizCtx(i IBizCtx)

func RegisterMiddleware

func RegisterMiddleware(i IMiddleware)

func RegisterMiddlewareJwt

func RegisterMiddlewareJwt(i IJwtAuth)

func RegisterSession

func RegisterSession(i ISession)

Types

type IAction

type IAction interface {
	OptAction(ctx context.Context, r *ghttp.Request) (err error) //操作行为(计算用户登录次数)
	RequestAction(ctx context.Context) (err error)               //系统操作行为(计算请求服务接口次数)
}

func Action

func Action() IAction

type IBizCtx

type IBizCtx interface {
	Init(r *ghttp.Request, customCtx *vo.Context)
	Get(ctx context.Context) *vo.Context
	SetSysUser(ctx context.Context, ctxUser *vo.ContextSysUser)
	SetSysUserData(ctx context.Context, user *entity.SysUser)
	SetData(ctx context.Context, data g.Map)
}

func BizCtx

func BizCtx() IBizCtx

type IJwtAuth

type IJwtAuth interface {
	Auth() *jwt.GfJWTMiddleware
}

func JwtAuth

func JwtAuth() IJwtAuth

type IMiddleware

type IMiddleware interface {
	ResponseHttpHandler(r *ghttp.Request)  //全局返回数据拦截(计算HTTP请求数据)
	ResponseProxyHandler(r *ghttp.Request) //全局返回数据拦截(计算代理接口请求数据)
	ResponseHandler(r *ghttp.Request)      //返回处理中间件(全局返回数据拦截)

	Ctx(r *ghttp.Request)     //自定义上下文对象
	Auth(r *ghttp.Request)    //前台系统权限控制,用户必须登录才能访问
	CORS(r *ghttp.Request)    //CORS垮域处理
	CSRF(r *ghttp.Request)    //CSRF防御设置
	JwtAuth(r *ghttp.Request) //jwt权限验证
}

func Middleware

func Middleware() IMiddleware

type ISession

type ISession interface {
	SetSysUser(ctx context.Context, user *entity.SysUser) error
	GetSysUser(ctx context.Context) *entity.SysUser
	RemoveSysUser(ctx context.Context) error
	SetLoginReferer(ctx context.Context, referer string) error
	GetLoginReferer(ctx context.Context) string
	RemoveLoginReferer(ctx context.Context) error
}

func Session

func Session() ISession

Jump to

Keyboard shortcuts

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