Files
tiku-backend.net/docs/migration/phase-4-external-provider-decoupling.md

43 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 第四阶段:外部服务解耦
状态:已完成。
## 目标
- 完全移除 Supabase Auth / Storage 兼容层。
- 业务层只依赖身份、短信、对象存储、支付和通知抽象。
- 第三方 SDK、账号、bucket、密钥和 claim 结构只出现在 Infrastructure provider 边界。
## 结果
- Provider 配置统一为 `TenantExternalProvider` + `TenantSecret`
- `Capability` 覆盖 Identity、ObjectStorage、Sms、Payment、Notification。
- 同一租户内 `Capability + Provider` 唯一。
- `ConfigPublic` 只保存公开配置;敏感字段必须进入 `TenantSecret`
- 删除旧 `TenantAuthProvider``TenantPaymentAccount` 和 Supabase storage provider 路径。
- 阿里云 OSS、阿里云短信、微信、支付宝 SDK 只允许在 Infrastructure 使用。
## 接口边界
- `IIdentityProvider`:封装 password、sms、wechat_web、wechat_miniapp 身份解析,不签发 JWT。
- `ISmsProvider`:只负责发送,验证码生成、哈希、频控和校验归业务服务。
- `IObjectStorageService`bucket/provider 从租户配置解析,业务输入不得任意覆盖。
- `IPaymentProvider`:支付账户和密钥从统一 Provider 配置加载。
- `INotificationProvider`:默认站内通知持久化,后续外发通道按 provider 扩展。
## 验收
- 租户 A/B Provider 配置和密钥互不读取。
- `ConfigPublic` 拒绝 `secret``token``key``privateKey` 等敏感字段。
- 资产上传不能伪造 bucket/provider。
- 业务层不引用第三方 SDK namespace。
- 生产代码不回流 Supabase provider 或旧专用配置表。
```bash
dotnet build TIKU-BACKEND.slnx --no-restore
dotnet test Tiku.UnitTests/Tiku.UnitTests.csproj --no-build
dotnet test Tiku.IntegrationTests/Tiku.IntegrationTests.csproj --no-build
dotnet ef migrations script --project Tiku.Infrastructure --startup-project Tiku.DbMigrator
git diff --check
```