This commit is contained in:
hero920103 committed 2026-10-19 01:13:17 +08:00
1 parent 5718a00e31
commit 1850ac640e
226 files changed
+37772 -12071

No files matched your search

+2 -16
View File
@@ -8,6 +8,7 @@ import (
"time"
"server/models"
"server/pkg/identity"
"server/pkg/jwtutil"
"server/services"
@@ -73,22 +74,7 @@ func (c *AppAggregateController) fail(msg string) {
// appClaims 校验 Bearer 令牌,允许 backend / app 两种身份
func (c *AppAggregateController) appClaims() (*jwtutil.Claims, error) {
auth := c.Ctx.Request.Header.Get("Authorization")
if auth == "" {
return nil, errNotLogin
}
parts := strings.SplitN(auth, " ", 2)
if len(parts) != 2 || parts[0] != "Bearer" {
return nil, errAuthFormat
}
claims, err := jwtutil.ParseToken(parts[1])
if err != nil {
return nil, errTokenInvalid
}
if claims.UserType != "backend" && claims.UserType != "app" {
return nil, errNoPermission
}
return claims, nil
return identity.Claims(c.Ctx.Request.Header.Get("Authorization"), identity.EndApp, identity.EndBackend)
}
// appModuleItem 模块卡片:在模块基础信息上标注当前租户是否已开通