# 外部集成 **分析日期:** 2026-02-28 ## APIs & 外部服务 **身份认证:** - **OpenIddict** - OAuth 2.0 / OpenID Connect 身份提供商 - 实现:内置 OpenIddict 认证服务器 - 客户端:fengling-api - 密钥:fengling-api-secret(硬编码,见 `src/Program.cs:62`) - 发行者:http://localhost:5132/ **反向代理:** - **YARP (YarpGateway)** - 反向代理网关 - 项目引用:`../../fengling-gateway/src/YarpGateway.csproj` - 用于 API 网关和请求转发 ## 数据存储 **数据库:** - **PostgreSQL** - 主数据库 - 连接:`DefaultConnection` (PlatformDbContext) - 连接:`GatewayConnection` (GatewayDbContext) - ORM:Entity Framework Core + Npgsql **表结构:** - 用户表 (ApplicationUser) - 角色表 (ApplicationRole) - 租户表 (Tenant) - OAuth 客户端表 - 审计日志表 (AuditLog) - 网关配置表 ## 身份认证 **认证方案:** - OpenIddict Validation (Bearer Token) - JWT Bearer 认证 - ASP.NET Core Identity **用户管理:** - ASP.NET Core Identity - 支持租户隔离 (TenantInfo) ## 监控与可观测性 **日志:** - 使用 Microsoft.Extensions.Logging - 通过 ILogger 注入 - 开发环境启用敏感数据日志 **API 文档:** - Swagger / OpenAPI - 端点:`/swagger/v1/swagger.json` ## CI/CD & 部署 **主机:** - Docker 容器化 - Dockerfile 位于 `src/Dockerfile` **CI/CD 流水线:** - Gitea Actions (`.gitea/workflows/`) - `deploy.yml` - 部署流水线 - `docker.yml` - Docker 构建 - `build.yml` - 构建流水线 ## 环境配置 **必需环境变量:** - `ConnectionStrings:DefaultConnection` - 平台数据库连接 - `ConnectionStrings:GatewayConnection` - 网关数据库连接 **配置文件:** - `appsettings.json` - 应用配置 - `appsettings.Development.json` - 开发配置 ## Webhooks & 回调 **无外部 Webhooks:** - 当前无外部系统回调集成 --- *集成审计:2026-02-28*