修改middleware包
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
|
||||
@@ -52,8 +53,8 @@ func (a *API) setupRoutes() {
|
||||
// --- Authenticated Routes ---
|
||||
// 所有在此注册的路由都需要通过 JWT 身份验证
|
||||
authGroup := a.echo.Group("/api/v1")
|
||||
authGroup.Use(middleware.AuthMiddleware(a.tokenService, a.userRepo)) // 1. 身份认证中间件
|
||||
authGroup.Use(middleware.AuditLogMiddleware(a.auditService)) // 2. 审计日志中间件
|
||||
authGroup.Use(middleware.AuthMiddleware(logs.AddCompName(context.Background(), "AuthMiddleware"), a.tokenService, a.userRepo)) // 1. 身份认证中间件
|
||||
authGroup.Use(middleware.AuditLogMiddleware(logs.AddCompName(context.Background(), "AuditLogMiddleware"), a.auditService)) // 2. 审计日志中间件
|
||||
{
|
||||
// 用户相关路由组
|
||||
userGroup := authGroup.Group("/users")
|
||||
|
||||
Reference in New Issue
Block a user