Fengling Gateway - 网关
Go to file
movingsam 4fd931d44b IMPL-11: 更新 TenantRoutingMiddleware 适配新 Transform
职责分离:
- Middleware: 负责 JWT 验证、TenantId 验证、设置 ClusterId 和 TenantId 到 HttpContext.Items
- Transform: 负责从数据库查询 Destination 并设置 ProxyRequest.RequestUri

修改内容:
1. TenantRoutingMiddleware:
   - 添加设置 TenantId 到 HttpContext.Items 供 Transform 使用
   - 修复服务名提取正则表达式,支持连字符(-)和下划线(_)
   - 更新 XML 文档,明确职责分离说明

2. TenantRoutingTransform:
   - 添加 ExtractTenantId 方法,优先从 HttpContext.Items 获取 TenantId
   - 保留从 JWT 提取作为回退机制

3. 单元测试:
   - 新增职责分离验证测试 (ShouldNotSetDestinationUri, ShouldOnlySetClusterIdAndTenantId)
   - 新增与 Transform 协作测试 (ShouldSetItemsForTransformConsumption)
   - 更新服务名提取测试,支持更多字符类型
   - 总测试数: 24个,全部通过
2026-03-08 01:20:20 +08:00
.gitea/workflows feat(plugin): 添加 NuGet 包发布配置 2026-03-01 17:10:06 +08:00
.planning feat: add MigrationTool for gateway config migration (IMPL-7) 2026-03-08 00:35:04 +08:00
k8s/base feat: add k8s deployment manifests and fix docker workflow env 2026-02-28 15:24:40 +08:00
logs chore(auth): upgrade OpenIddict to 7.2.0 2026-02-01 23:24:47 +08:00
sql chore(auth): upgrade OpenIddict to 7.2.0 2026-02-01 23:24:47 +08:00
src IMPL-11: 更新 TenantRoutingMiddleware 适配新 Transform 2026-03-08 01:20:20 +08:00
tests IMPL-11: 更新 TenantRoutingMiddleware 适配新 Transform 2026-03-08 01:20:20 +08:00
tools/MigrationTool feat: add MigrationTool for gateway config migration (IMPL-7) 2026-03-08 00:35:04 +08:00
.gitignore Add .gitignore 2026-02-25 17:28:18 +08:00
Directory.Build.props feat: add MigrationTool for gateway config migration (IMPL-7) 2026-03-08 00:35:04 +08:00
Dockerfile refactor: move project to src/ and add slnx 2026-02-28 13:10:41 +08:00
MigrationTask.sln feat: add MigrationTool for gateway config migration (IMPL-7) 2026-03-08 00:35:04 +08:00
NuGet.Config fix: 升级 Fengling.Platform 包并修复编译警告 2026-03-04 13:14:26 +08:00
YarpGateway.slnx refactor: reorganize project structure into yarpgateway folder 2026-03-01 17:47:48 +08:00
网关配置的新想法.md feat: add MigrationTool for gateway config migration (IMPL-7) 2026-03-08 00:35:04 +08:00