add: User transmission interface encryption

This commit is contained in:
EUForest
2025-10-12 16:23:29 +08:00
parent f3bc933a99
commit 46e6a9784d
27 changed files with 410 additions and 22 deletions
+3
View File
@@ -40,6 +40,8 @@ func AuthMiddleware(svc *svc.ServiceContext) func(c *gin.Context) {
c.Abort()
return
}
loginType := claims["LoginType"].(string)
// get user id from token
userId := int64(claims["UserId"].(float64))
// get session id from token
@@ -77,6 +79,7 @@ func AuthMiddleware(svc *svc.ServiceContext) func(c *gin.Context) {
c.Abort()
return
}
ctx = context.WithValue(ctx, constant.LoginType, loginType)
ctx = context.WithValue(ctx, constant.CtxKeyUser, userInfo)
ctx = context.WithValue(ctx, constant.CtxKeySessionID, sessionId)
c.Request = c.Request.WithContext(ctx)