Skip to content

Commit ecdd195

Browse files
committed
feat: add auth/security, migration infra, observability, and conventional DI
Phase 1 - Auth & Security: - Register JWT Bearer authentication & authorization in WebHost - Add CORS default policy (AllowAnyOrigin) - Add SecurityHeadersMiddleware (nosniff, DENY, referrer-policy) - Add CurrentUserMiddleware bridging ClaimsPrincipal to ICurrentUser - Add GlobalExceptionMiddleware for non-MVC exception handling Phase 2 - Multi-DbContext Migration Infrastructure: - Add MigrationHistoryTableNameResolver for per-DbContext history tables - Auto-apply MigrationsHistoryTable in SQLite and PostgreSQL providers - Add ChengYuanDesignTimeDbContextFactory<T> abstract base - Add ChengYuanSqliteDesignTimeDbContextFactory<T> with config-based connection string - Create design-time factories for all 6 application DbContexts Phase 3 - Observability: - Integrate Serilog with config-based setup and request logging - Add OpenAPI via AddOpenApi() and MapOpenApi() - Add appsettings.json and appsettings.Development.json Phase 4 - Conventional DI (Identity pilot): - Add ExposeServicesAttribute for multi-interface service exposure - Apply IScopedService + ExposeServices to UserManager and RoleManager - Replace manual registrations with AddConventionalServices in Identity Tests: 365 total (14 new), all passing
1 parent df989a7 commit ecdd195

File tree

52 files changed

+4708
-635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+4708
-635
lines changed

Directory.Packages.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.0" />
1111
<PackageVersion Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="10.0.0" />
1212
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.0" />
13+
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
1314
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
1415
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
1516
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="10.0.0" />
@@ -21,11 +22,15 @@
2122
<PackageVersion Include="Cronos" Version="0.8.4" />
2223
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" />
2324
<PackageVersion Include="Microsoft.Extensions.Options" Version="10.0.0" />
25+
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.0" />
26+
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
2427
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="10.0.0" />
2528
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.0" />
29+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.0" />
2630
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.0" />
2731
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.0" />
2832
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
33+
<PackageVersion Include="Serilog.AspNetCore" Version="9.0.0" />
2934
<!-- Analyzers -->
3035
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="5.0.0-1.25277.114" />
3136
<!-- Testing -->
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
using ChengYuan.EntityFrameworkCore;
2+
3+
namespace ChengYuan.AuditLogging;
4+
5+
public sealed class AuditLoggingDbContextDesignTimeFactory : ChengYuanSqliteDesignTimeDbContextFactory<AuditLoggingDbContext>;

src/Applications/AuditLogging/ChengYuan.AuditLogging.Persistence/ChengYuan.AuditLogging.Persistence.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
<ItemGroup>
88
<ProjectReference Include="..\..\..\Framework\Data\ChengYuan.EntityFrameworkCore\ChengYuan.EntityFrameworkCore.csproj" />
9+
<ProjectReference Include="..\..\..\Framework\Data\ChengYuan.Data.Sqlite\ChengYuan.Data.Sqlite.csproj" />
910
<ProjectReference Include="..\ChengYuan.AuditLogging.Application\ChengYuan.AuditLogging.Application.csproj" />
1011
</ItemGroup>
1112

0 commit comments

Comments
 (0)