2022-12-11 20:48:18 +08:00
|
|
|
// ================================================================================
|
2024-03-07 20:08:56 +08:00
|
|
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
2022-12-11 20:48:18 +08:00
|
|
|
// You can delete these comments if you wish manually maintain this interface file.
|
|
|
|
// ================================================================================
|
2022-11-24 23:37:34 +08:00
|
|
|
|
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
2023-06-13 15:45:30 +08:00
|
|
|
"context"
|
|
|
|
|
2022-11-24 23:37:34 +08:00
|
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
|
|
)
|
|
|
|
|
2022-12-11 20:48:18 +08:00
|
|
|
type (
|
|
|
|
IMiddleware interface {
|
2024-03-07 20:08:56 +08:00
|
|
|
// AdminAuth 后台鉴权中间件
|
2022-12-11 20:48:18 +08:00
|
|
|
AdminAuth(r *ghttp.Request)
|
2024-03-07 20:08:56 +08:00
|
|
|
// ApiAuth API鉴权中间件
|
2022-12-11 20:48:18 +08:00
|
|
|
ApiAuth(r *ghttp.Request)
|
2024-03-07 20:08:56 +08:00
|
|
|
// HomeAuth 前台页面鉴权中间件
|
2023-06-15 20:40:19 +08:00
|
|
|
HomeAuth(r *ghttp.Request)
|
2024-03-07 20:08:56 +08:00
|
|
|
// Ctx 初始化请求上下文
|
2022-12-11 20:48:18 +08:00
|
|
|
Ctx(r *ghttp.Request)
|
2024-03-07 20:08:56 +08:00
|
|
|
// CORS allows Cross-origin resource sharing.
|
2022-12-11 20:48:18 +08:00
|
|
|
CORS(r *ghttp.Request)
|
2024-03-07 20:08:56 +08:00
|
|
|
// DemoLimit 演示系统操作限制
|
2022-12-11 20:48:18 +08:00
|
|
|
DemoLimit(r *ghttp.Request)
|
2024-03-07 20:08:56 +08:00
|
|
|
// Addon 插件中间件
|
2023-02-23 17:53:04 +08:00
|
|
|
Addon(r *ghttp.Request)
|
2024-03-07 20:08:56 +08:00
|
|
|
// DeliverUserContext 将用户信息传递到上下文中
|
2023-06-13 15:45:30 +08:00
|
|
|
DeliverUserContext(r *ghttp.Request) (err error)
|
2024-03-07 20:08:56 +08:00
|
|
|
// IsExceptAuth 是否是不需要验证权限的路由地址
|
2023-06-13 15:45:30 +08:00
|
|
|
IsExceptAuth(ctx context.Context, appName, path string) bool
|
2024-03-07 20:08:56 +08:00
|
|
|
// IsExceptLogin 是否是不需要登录的路由地址
|
2023-06-13 15:45:30 +08:00
|
|
|
IsExceptLogin(ctx context.Context, appName, path string) bool
|
2024-03-07 20:08:56 +08:00
|
|
|
// Blacklist IP黑名单限制中间件
|
2023-01-25 11:49:21 +08:00
|
|
|
Blacklist(r *ghttp.Request)
|
2024-03-07 20:08:56 +08:00
|
|
|
// Develop 开发工具白名单过滤
|
2023-02-08 20:29:34 +08:00
|
|
|
Develop(r *ghttp.Request)
|
2024-03-07 20:08:56 +08:00
|
|
|
// PreFilter 请求输入预处理
|
|
|
|
// api使用gf规范路由并且XxxReq结构体实现了validate.Filter接口即可
|
2023-07-20 18:01:10 +08:00
|
|
|
PreFilter(r *ghttp.Request)
|
2024-03-07 20:08:56 +08:00
|
|
|
// ResponseHandler HTTP响应预处理
|
2022-12-11 20:48:18 +08:00
|
|
|
ResponseHandler(r *ghttp.Request)
|
2024-03-07 20:08:56 +08:00
|
|
|
// WebSocketAuth websocket鉴权中间件
|
2023-05-12 16:20:22 +08:00
|
|
|
WebSocketAuth(r *ghttp.Request)
|
2022-12-11 20:48:18 +08:00
|
|
|
}
|
|
|
|
)
|
2022-11-24 23:37:34 +08:00
|
|
|
|
2022-12-11 20:48:18 +08:00
|
|
|
var (
|
|
|
|
localMiddleware IMiddleware
|
|
|
|
)
|
2022-11-24 23:37:34 +08:00
|
|
|
|
|
|
|
func Middleware() IMiddleware {
|
|
|
|
if localMiddleware == nil {
|
|
|
|
panic("implement not found for interface IMiddleware, forgot register?")
|
|
|
|
}
|
|
|
|
return localMiddleware
|
|
|
|
}
|
|
|
|
|
|
|
|
func RegisterMiddleware(i IMiddleware) {
|
|
|
|
localMiddleware = i
|
|
|
|
}
|