feat: follow llm.txt
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package middlewares
|
||||
|
||||
import (
|
||||
"go.ipao.vip/atom/container"
|
||||
"quyun/v2/app/errorx"
|
||||
"quyun/v2/app/services"
|
||||
"quyun/v2/database/models"
|
||||
@@ -12,9 +11,9 @@ import (
|
||||
)
|
||||
|
||||
func (f *Middlewares) TenantResolve(c fiber.Ctx) error {
|
||||
tenantCode := c.Params("tenant_code")
|
||||
tenantCode := c.Params("tenantCode")
|
||||
if tenantCode == "" {
|
||||
return errorx.ErrMissingParameter.WithMsg("缺少 tenant_code")
|
||||
return errorx.ErrMissingParameter.WithMsg("缺少 tenantCode")
|
||||
}
|
||||
|
||||
tenantModel, err := services.Tenant.FindByCode(c, tenantCode)
|
||||
@@ -39,18 +38,7 @@ func (f *Middlewares) TenantAuth(c fiber.Ctx) error {
|
||||
return errorx.ErrTokenMissing
|
||||
}
|
||||
|
||||
jwtProvider := f.jwt
|
||||
if jwtProvider == nil {
|
||||
if err := container.Container.Invoke(func(j *jwt.JWT) {
|
||||
jwtProvider = j
|
||||
f.jwt = j
|
||||
}); err != nil {
|
||||
f.log.WithError(err).Error("middlewares.tenant.auth.jwt_provider_missing")
|
||||
return errorx.ErrInternalError.WithMsg("jwt provider missing")
|
||||
}
|
||||
}
|
||||
|
||||
claims, err := jwtProvider.Parse(authHeader)
|
||||
claims, err := f.jwt.Parse(authHeader)
|
||||
if err != nil {
|
||||
f.log.WithError(err).Warn("middlewares.tenant.auth.invalid_token")
|
||||
switch err {
|
||||
|
||||
Reference in New Issue
Block a user