diff --git a/AGENTS.md b/AGENTS.md index fc3970e..a726f46 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -29,7 +29,8 @@ node node_modules/@angular/cli/bin/ng.js build --configuration development node node_modules/@angular/cli/bin/ng.js test --watch=false ``` -There is no lint script. Backend test projects currently contain no tests. +There is no lint script. Infrastructure tests require Docker with Linux containers +and use a temporary PostgreSQL container; other backend test projects are empty. AppHost starts containers, installs frontend dependencies and applies migrations; do not use it as a substitute for build/test verification. See README.md for setup. diff --git a/Directory.Packages.props b/Directory.Packages.props index f278cc0..6d64d0e 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,6 +8,7 @@ + @@ -23,5 +24,6 @@ + diff --git a/README.md b/README.md index 566a56e..b046c6e 100644 --- a/README.md +++ b/README.md @@ -55,10 +55,14 @@ All projects use the `ChessRealms.Platform` prefix: - `src/ChessRealms.Platform.MigrationWorker` — console host that applies migrations and exits; references Infrastructure and ServiceDefaults. - `orchestration/ChessRealms.Platform.AppHost` — PostgreSQL, migration worker, API, and Angular frontend orchestration. - `orchestration/ChessRealms.Platform.ServiceDefaults` — shared telemetry, health checks, service discovery, and HTTP resilience. -- `tests/` — separate empty xUnit v3 projects referencing Api, Application, Domain, and Infrastructure respectively. +- `tests/` — xUnit v3 projects referencing Api, Application, Domain, and Infrastructure respectively. `Infrastructure` leaves room for integrations beyond persistence. `PlatformDbContext` currently has no entities. An empty `InitialCreate` migration establishes the migration pipeline without adding business tables. +The isolated `Infrastructure/Identity` module provides ASP.NET Core Identity stores +in a separate `IdentityDbContext`, using the `identity` schema in the same PostgreSQL +database. See [architecture decisions](docs/architecture.md) for boundaries and scope. + ### Build and test Run from the repository root: @@ -70,7 +74,10 @@ dotnet build ChessRealms.Platform.slnx --no-restore dotnet test ChessRealms.Platform.slnx --no-build --no-restore ``` -The test projects intentionally contain no tests, so the runner currently reports that no tests were found. Package versions are centralized and each project has a NuGet lock file. +Infrastructure tests require Docker with Linux containers. Testcontainers starts a +temporary PostgreSQL 18.3 container and verifies migrations and Identity persistence; +it does not use the development database or AppHost. The other test projects are +currently empty. Package versions are centralized and each project has a NuGet lock file. For the frontend: @@ -85,7 +92,7 @@ The Angular app stays outside the .NET solution; Aspire runs it directly from it ### Continuous integration -The [CI workflow](.github/workflows/ci.yml) runs on every push and pull request with separate backend and frontend jobs on Ubuntu. The backend uses the SDK from `global.json`, restores with `--locked-mode`, builds, and runs tests without restoring or rebuilding. The frontend uses Node.js 26 and the npm version from `package.json`, installs with `npm ci`, builds the development configuration, and runs Vitest without watch mode. CI does not start AppHost or containers. +The [CI workflow](.github/workflows/ci.yml) runs on every push and pull request with separate backend and frontend jobs on Ubuntu. The backend uses the SDK from `global.json`, restores with `--locked-mode`, builds, and runs tests without restoring or rebuilding. Infrastructure tests use the runner's Docker daemon for temporary PostgreSQL containers. The frontend uses Node.js 26 and the npm version from `package.json`, installs with `npm ci`, builds the development configuration, and runs Vitest without watch mode. CI does not start AppHost. ### Run locally @@ -105,10 +112,12 @@ The worker has a two-minute timeout, configurable through `Migration__Timeout` ( ### Add a migration ```shell -dotnet ef migrations add MigrationName --project src/ChessRealms.Platform.Infrastructure --output-dir Persistence/Migrations +dotnet ef migrations add MigrationName --context PlatformDbContext --project src/ChessRealms.Platform.Infrastructure --output-dir Persistence/Migrations ``` -The design-time factory allows scaffolding without starting PostgreSQL or AppHost. For EF commands that connect to a database, set `ConnectionStrings__platform` to the connection string shown in the Aspire dashboard. Apply migrations through MigrationWorker; the API does not migrate the database on startup. +For Identity migrations, use `--context IdentityDbContext --output-dir Identity/Persistence/Migrations` instead. + +The design-time factories allow scaffolding without starting PostgreSQL or AppHost. For EF commands that connect to a database, set `ConnectionStrings__platform` to the connection string shown in the Aspire dashboard. Apply migrations through MigrationWorker, which migrates both contexts; the API does not migrate the database on startup. Documentation is maintained in English. diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 0000000..76b632e --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,58 @@ +# Platform architecture decisions + +## Boundaries + +The platform remains a modular monolith. Domain has no project dependencies; +Application references Domain, Infrastructure references Application, and Api +composes the application and infrastructure. PostgreSQL and EF Core provide persistence. + +Identity is an isolated module under `Infrastructure/Identity`, not a microservice. +It owns `PlatformUser`, its EF stores, DI registration, and migrations. Its separate +`IdentityDbContext` uses the same database as `PlatformDbContext`, but owns the +`identity` schema and its own migration history. MigrationWorker applies platform +migrations followed by Identity migrations; Api never migrates on startup. +These are separate migration operations, not one cross-context transaction. + +ASP.NET Core Identity types must not enter Domain or Application. Future application +use cases should access identity through narrow application contracts and stable +user IDs. Game participants will not require an `IdentityUser` object. + +## Accounts and authentication + +Accounts use GUID identifiers and ASP.NET Core Identity for password hashing, +validation, and persistence. Email must be unique (including a database constraint +on normalized email). Confirmed email is configured as a prerequisite for sign-in; +future login code must enforce it before issuing tokens. Roles are not required yet, +so the context uses the user-only Identity model. + +The chosen direction is application-issued JWT access tokens, rotating refresh +tokens, and revocation of individual or all login sessions, without a separate +OAuth authorization server. Token lifetimes, refresh transport, concurrency handling, +and immediate versus expiry-based access-token revocation remain to be specified. +Google login is optional and can be added later. + +This foundation registers Identity core services and EF stores only. It does not +enable authentication schemes, expose endpoints, issue tokens, or provide email +confirmation/reset flows. Token providers, email delivery, abuse protection, and +Angular integration belong to subsequent work. + +## Game functionality + +Chess rules come from ChessRealms/Engine. Guests are temporary participants without +an ASP.NET Core Identity record, but require a protected guest session. They can play +with guests or registered users. Login sessions, lobbies, and chess games are distinct +concepts. Private lobbies will support invitations to registered users, an opt-out +for incoming invitations, optional passwords, and invitation spam protection. + +Clock requirements and guest-to-account conversion remain open. Playing against the +computer remains part of the initial product milestone. Branch protection and +repository rules will be configured manually later. + +## Delivery order + +1. Identity persistence and integration verification (this foundation). +2. Registration/email confirmation, JWT and refresh sessions, revocation, and recovery. +3. Angular authentication integration. +4. Engine integration and persistent game state. +5. Online games, reconnects, guests, lobbies, and invitations. +6. Computer opponent; optional Google login and additional Identity features separately. diff --git a/src/ChessRealms.Platform.Api/packages.lock.json b/src/ChessRealms.Platform.Api/packages.lock.json index 45bd62f..1540015 100644 --- a/src/ChessRealms.Platform.Api/packages.lock.json +++ b/src/ChessRealms.Platform.Api/packages.lock.json @@ -182,6 +182,7 @@ "dependencies": { "Aspire.Npgsql.EntityFrameworkCore.PostgreSQL": "[13.6.5, )", "ChessRealms.Platform.Application": "[1.0.0, )", + "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.15, )", "Microsoft.EntityFrameworkCore": "[10.0.15, )", "Microsoft.EntityFrameworkCore.Relational": "[10.0.15, )", "Npgsql.EntityFrameworkCore.PostgreSQL": "[10.0.3, )" @@ -212,6 +213,15 @@ "OpenTelemetry.Extensions.Hosting": "1.17.0" } }, + "Microsoft.AspNetCore.Identity.EntityFrameworkCore": { + "type": "CentralTransitive", + "requested": "[10.0.15, )", + "resolved": "10.0.15", + "contentHash": "vazYMsviWu/+efWfWiD95ZHZZ/SUf10MAfWeJ8ADK8oa5SjLO41NE7ii0eVQhHqWBBXh4s0zMQor2F8J25Oh5g==", + "dependencies": { + "Microsoft.EntityFrameworkCore.Relational": "10.0.15" + } + }, "Microsoft.EntityFrameworkCore": { "type": "CentralTransitive", "requested": "[10.0.15, )", diff --git a/src/ChessRealms.Platform.Infrastructure/ChessRealms.Platform.Infrastructure.csproj b/src/ChessRealms.Platform.Infrastructure/ChessRealms.Platform.Infrastructure.csproj index 0d7f31c..5b7aa55 100644 --- a/src/ChessRealms.Platform.Infrastructure/ChessRealms.Platform.Infrastructure.csproj +++ b/src/ChessRealms.Platform.Infrastructure/ChessRealms.Platform.Infrastructure.csproj @@ -10,6 +10,7 @@ + diff --git a/src/ChessRealms.Platform.Infrastructure/DependencyInjection.cs b/src/ChessRealms.Platform.Infrastructure/DependencyInjection.cs index 1760097..59c8398 100644 --- a/src/ChessRealms.Platform.Infrastructure/DependencyInjection.cs +++ b/src/ChessRealms.Platform.Infrastructure/DependencyInjection.cs @@ -1,3 +1,4 @@ +using ChessRealms.Platform.Infrastructure.Identity; using ChessRealms.Platform.Infrastructure.Persistence; using Microsoft.Extensions.Hosting; @@ -10,6 +11,7 @@ public static TBuilder AddInfrastructure(this TBuilder builder) where TBuilder : IHostApplicationBuilder { builder.AddNpgsqlDbContext("platform"); + builder.AddPlatformIdentity(); return builder; } } diff --git a/src/ChessRealms.Platform.Infrastructure/Identity/DependencyInjection.cs b/src/ChessRealms.Platform.Infrastructure/Identity/DependencyInjection.cs new file mode 100644 index 0000000..192dd8c --- /dev/null +++ b/src/ChessRealms.Platform.Infrastructure/Identity/DependencyInjection.cs @@ -0,0 +1,26 @@ +using ChessRealms.Platform.Infrastructure.Identity.Persistence; + +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace ChessRealms.Platform.Infrastructure.Identity; + +public static class DependencyInjection +{ + public static TBuilder AddPlatformIdentity(this TBuilder builder) + where TBuilder : IHostApplicationBuilder + { + builder.AddNpgsqlDbContext("platform", + configureDbContextOptions: options => options.UseNpgsql(postgres => + postgres.MigrationsHistoryTable("__EFMigrationsHistory", IdentityDbContext.Schema))); + + builder.Services.AddIdentityCore(options => + { + options.User.RequireUniqueEmail = true; + options.SignIn.RequireConfirmedEmail = true; + }).AddEntityFrameworkStores(); + + return builder; + } +} diff --git a/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/IdentityDbContext.cs b/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/IdentityDbContext.cs new file mode 100644 index 0000000..5523d90 --- /dev/null +++ b/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/IdentityDbContext.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore; + +namespace ChessRealms.Platform.Infrastructure.Identity.Persistence; + +public sealed class IdentityDbContext(DbContextOptions options) + : Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserContext(options) +{ + public const string Schema = "identity"; + + protected override void OnModelCreating(ModelBuilder builder) + { + base.OnModelCreating(builder); + builder.HasDefaultSchema(Schema); + builder.Entity().HasIndex(user => user.NormalizedEmail) + .IsUnique(); + } +} diff --git a/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/IdentityDbContextFactory.cs b/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/IdentityDbContextFactory.cs new file mode 100644 index 0000000..40b584b --- /dev/null +++ b/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/IdentityDbContextFactory.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Design; + +namespace ChessRealms.Platform.Infrastructure.Identity.Persistence; + +public sealed class IdentityDbContextFactory : IDesignTimeDbContextFactory +{ + public IdentityDbContext CreateDbContext(string[] args) + { + string connectionString = Environment.GetEnvironmentVariable("ConnectionStrings__platform") + ?? "Host=localhost;Database=platform;Username=postgres"; + DbContextOptions options = new DbContextOptionsBuilder() + .UseNpgsql(connectionString, postgres => + postgres.MigrationsHistoryTable("__EFMigrationsHistory", IdentityDbContext.Schema)) + .Options; + + return new IdentityDbContext(options); + } +} diff --git a/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/Migrations/20261116235648_InitialIdentity.Designer.cs b/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/Migrations/20261116235648_InitialIdentity.Designer.cs new file mode 100644 index 0000000..266c494 --- /dev/null +++ b/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/Migrations/20261116235648_InitialIdentity.Designer.cs @@ -0,0 +1,188 @@ +// +using System; +using ChessRealms.Platform.Infrastructure.Identity.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace ChessRealms.Platform.Infrastructure.Identity.Persistence.Migrations +{ + [DbContext(typeof(IdentityDbContext))] + [Migration("20261116235648_InitialIdentity")] + partial class InitialIdentity + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("identity") + .HasAnnotation("ProductVersion", "10.0.15") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("ChessRealms.Platform.Infrastructure.Identity.PlatformUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .IsUnique() + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("ChessRealms.Platform.Infrastructure.Identity.PlatformUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("ChessRealms.Platform.Infrastructure.Identity.PlatformUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("ChessRealms.Platform.Infrastructure.Identity.PlatformUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/Migrations/20261116235648_InitialIdentity.cs b/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/Migrations/20261116235648_InitialIdentity.cs new file mode 100644 index 0000000..022b5be --- /dev/null +++ b/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/Migrations/20261116235648_InitialIdentity.cs @@ -0,0 +1,158 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace ChessRealms.Platform.Infrastructure.Identity.Persistence.Migrations +{ + /// + public partial class InitialIdentity : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.EnsureSchema( + name: "identity"); + + migrationBuilder.CreateTable( + name: "AspNetUsers", + schema: "identity", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "boolean", nullable: false), + PasswordHash = table.Column(type: "text", nullable: true), + SecurityStamp = table.Column(type: "text", nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true), + PhoneNumber = table.Column(type: "text", nullable: true), + PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), + TwoFactorEnabled = table.Column(type: "boolean", nullable: false), + LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), + LockoutEnabled = table.Column(type: "boolean", nullable: false), + AccessFailedCount = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserClaims", + schema: "identity", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + UserId = table.Column(type: "uuid", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetUserClaims_AspNetUsers_UserId", + column: x => x.UserId, + principalSchema: "identity", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserLogins", + schema: "identity", + columns: table => new + { + LoginProvider = table.Column(type: "text", nullable: false), + ProviderKey = table.Column(type: "text", nullable: false), + ProviderDisplayName = table.Column(type: "text", nullable: true), + UserId = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); + table.ForeignKey( + name: "FK_AspNetUserLogins_AspNetUsers_UserId", + column: x => x.UserId, + principalSchema: "identity", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + schema: "identity", + columns: table => new + { + UserId = table.Column(type: "uuid", nullable: false), + LoginProvider = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: false), + Value = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AspNetUserTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalSchema: "identity", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserClaims_UserId", + schema: "identity", + table: "AspNetUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserLogins_UserId", + schema: "identity", + table: "AspNetUserLogins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + schema: "identity", + table: "AspNetUsers", + column: "NormalizedEmail", + unique: true); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + schema: "identity", + table: "AspNetUsers", + column: "NormalizedUserName", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AspNetUserClaims", + schema: "identity"); + + migrationBuilder.DropTable( + name: "AspNetUserLogins", + schema: "identity"); + + migrationBuilder.DropTable( + name: "AspNetUserTokens", + schema: "identity"); + + migrationBuilder.DropTable( + name: "AspNetUsers", + schema: "identity"); + } + } +} diff --git a/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/Migrations/IdentityDbContextModelSnapshot.cs b/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/Migrations/IdentityDbContextModelSnapshot.cs new file mode 100644 index 0000000..f641821 --- /dev/null +++ b/src/ChessRealms.Platform.Infrastructure/Identity/Persistence/Migrations/IdentityDbContextModelSnapshot.cs @@ -0,0 +1,185 @@ +// +using System; +using ChessRealms.Platform.Infrastructure.Identity.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace ChessRealms.Platform.Infrastructure.Identity.Persistence.Migrations +{ + [DbContext(typeof(IdentityDbContext))] + partial class IdentityDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("identity") + .HasAnnotation("ProductVersion", "10.0.15") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("ChessRealms.Platform.Infrastructure.Identity.PlatformUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .IsUnique() + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", "identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("ChessRealms.Platform.Infrastructure.Identity.PlatformUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("ChessRealms.Platform.Infrastructure.Identity.PlatformUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("ChessRealms.Platform.Infrastructure.Identity.PlatformUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/ChessRealms.Platform.Infrastructure/Identity/PlatformUser.cs b/src/ChessRealms.Platform.Infrastructure/Identity/PlatformUser.cs new file mode 100644 index 0000000..d90e634 --- /dev/null +++ b/src/ChessRealms.Platform.Infrastructure/Identity/PlatformUser.cs @@ -0,0 +1,11 @@ +using Microsoft.AspNetCore.Identity; + +namespace ChessRealms.Platform.Infrastructure.Identity; + +public sealed class PlatformUser : IdentityUser +{ + public PlatformUser() + { + Id = Guid.NewGuid(); + } +} diff --git a/src/ChessRealms.Platform.Infrastructure/packages.lock.json b/src/ChessRealms.Platform.Infrastructure/packages.lock.json index e4467e4..e5a440a 100644 --- a/src/ChessRealms.Platform.Infrastructure/packages.lock.json +++ b/src/ChessRealms.Platform.Infrastructure/packages.lock.json @@ -26,6 +26,16 @@ "OpenTelemetry.Extensions.Hosting": "1.17.0" } }, + "Microsoft.AspNetCore.Identity.EntityFrameworkCore": { + "type": "Direct", + "requested": "[10.0.15, )", + "resolved": "10.0.15", + "contentHash": "vazYMsviWu/+efWfWiD95ZHZZ/SUf10MAfWeJ8ADK8oa5SjLO41NE7ii0eVQhHqWBBXh4s0zMQor2F8J25Oh5g==", + "dependencies": { + "Microsoft.EntityFrameworkCore.Relational": "10.0.15", + "Microsoft.Extensions.Identity.Stores": "10.0.15" + } + }, "Microsoft.EntityFrameworkCore": { "type": "Direct", "requested": "[10.0.15, )", @@ -86,6 +96,19 @@ "resolved": "2.14.1", "contentHash": "lQKvtaTDOXnoVJ20ibTuSIOf2i0uO0MPbDhd1jm238I+U/2ZnRENj0cktKZhtchBMtCUSRQ5v4xBCUbKNmyVMw==" }, + "Microsoft.AspNetCore.Cryptography.Internal": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "QsgH1P7/bDthx8inoa659//xBmWyKQri+NxQz9X7TgubhQzNL/eZllbay0jB2LXoxf3i1BJ8xgdNzyUqZuwhTw==" + }, + "Microsoft.AspNetCore.Cryptography.KeyDerivation": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "egaMlQze3SMaBjwhzwU05K8KbJ3Il5XRTkTyC85HREzrbpJr42oFKXTvZYmxIEFRrQATBV5uwPCjFY2ujhL3dg==", + "dependencies": { + "Microsoft.AspNetCore.Cryptography.Internal": "10.0.15" + } + }, "Microsoft.Build.Framework": { "type": "Transitive", "resolved": "18.0.2", @@ -188,11 +211,11 @@ }, "Microsoft.Extensions.Configuration": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "UcnvaEaMvRckDDhyqY1OZkFwBqpZArkHFKB6dWaQWT9XTuNttNNX8Cqsb/Sic2LfJxsMLJUXnYrxY3iX5LN9pQ==", + "resolved": "10.0.15", + "contentHash": "XwGgzRlryUvICZbY/oNlR1MbFDYg6gePDoW38RyUis8vEAVKIHvMy9di5dujK6dObbUOQJpHtrjUZ2rU0V7RvQ==", "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.14", - "Microsoft.Extensions.Primitives": "10.0.14" + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.Primitives": "10.0.15" } }, "Microsoft.Extensions.Configuration.Abstractions": { @@ -205,11 +228,11 @@ }, "Microsoft.Extensions.Configuration.Binder": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "brDb5kgle2iY2lWHgeV/KOqnBEpVnlMFigGJ/WW7KP9Nj6C/t53f/h5boYyVXB0bEhgpL+ctbewDJMI+zAMj1w==", + "resolved": "10.0.15", + "contentHash": "VOjlZlv9b3woS1TcI8Ts1r2IsmsT7hqkx7o2sMSNzE5fPBGKfhJszlEIhtQVzUz4H8Uw/7Jtuj9x7wGlCUsi2A==", "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.14", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.14" + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15" } }, "Microsoft.Extensions.Configuration.EnvironmentVariables": { @@ -239,13 +262,23 @@ "resolved": "10.0.15", "contentHash": "087ome/PndkacsUGmB6OoTyhQ3UwoSRqv9odKbvdD4h3o6TqSIVIK/v1WaNKZ/oiMUVuMcV0l2yXdt55RHRxGw==" }, + "Microsoft.Extensions.Diagnostics": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "+FK6gPJDZ+8abQ7WAXUSxK7jgwhATzHlt3TCiO/paVwx9I8VsdHHoapugUUZNHr0Re2UFDoxpPpCp5kp6TX5iQ==", + "dependencies": { + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Diagnostics.Abstractions": "10.0.15", + "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.15" + } + }, "Microsoft.Extensions.Diagnostics.Abstractions": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "vm+PPso6vOwGeX52MdOPh6z/R6KHgxQUwqq7k7Jc9jhy2JOxO2KB4xfoJQBBp2Ni8M4zKgJ4r2a1dgrYG7+MKw==", + "resolved": "10.0.15", + "contentHash": "oD1xl7uoHGnVuCEo3bjj1W3cVTMe55QVdkeis9YYdcnLfU42X58XTx6A1Sl7kiqp5LbzVrUvdy7F/mNKaOnpLg==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14", - "Microsoft.Extensions.Options": "10.0.14" + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15" } }, "Microsoft.Extensions.Diagnostics.HealthChecks": { @@ -294,6 +327,27 @@ "Microsoft.Extensions.Logging.Abstractions": "10.0.14" } }, + "Microsoft.Extensions.Identity.Core": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "XMr9hhUFL/9IeOCsaLxJH974n+cYDWs3NpDwliXcvIHFoVlcNdr5/kPPeRYz1IDxW35WBbo9w3mYfYhJJtJ6mA==", + "dependencies": { + "Microsoft.AspNetCore.Cryptography.KeyDerivation": "10.0.15", + "Microsoft.Extensions.Diagnostics": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15" + } + }, + "Microsoft.Extensions.Identity.Stores": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "IEnTqSkIZk7Rq9eUkV0Z/tgQD37AITOKB1xp38xPrKf9Bm9de3h8SrNvz6YWUOlAibMRYDzQUw9qqmIiKFsWHA==", + "dependencies": { + "Microsoft.Extensions.Caching.Abstractions": "10.0.15", + "Microsoft.Extensions.Identity.Core": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15" + } + }, "Microsoft.Extensions.Logging": { "type": "Transitive", "resolved": "10.0.15", @@ -338,14 +392,14 @@ }, "Microsoft.Extensions.Options.ConfigurationExtensions": { "type": "Transitive", - "resolved": "10.0.0", - "contentHash": "tL9cSl3maS5FPzp/3MtlZI21ExWhni0nnUCF8HY4npTsINw45n9SNDbkKXBMtFyUFGSsQep25fHIDN4f/Vp3AQ==", + "resolved": "10.0.15", + "contentHash": "yQX7dFAHm9xKBh2TLiA3aTrmOkgEeMRoS7UM/XuVy3CpddaluUXDIMiM8na5q6JMesH8zt3bKIDu/3hkEhVo7Q==", "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.0", - "Microsoft.Extensions.Configuration.Binder": "10.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.0", - "Microsoft.Extensions.Options": "10.0.0", - "Microsoft.Extensions.Primitives": "10.0.0" + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.Configuration.Binder": "10.0.15", + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15", + "Microsoft.Extensions.Primitives": "10.0.15" } }, "Microsoft.Extensions.Primitives": { diff --git a/src/ChessRealms.Platform.MigrationWorker/MigrationService.cs b/src/ChessRealms.Platform.MigrationWorker/MigrationService.cs index 2a01322..36d69cd 100644 --- a/src/ChessRealms.Platform.MigrationWorker/MigrationService.cs +++ b/src/ChessRealms.Platform.MigrationWorker/MigrationService.cs @@ -1,3 +1,4 @@ +using ChessRealms.Platform.Infrastructure.Identity.Persistence; using ChessRealms.Platform.Infrastructure.Persistence; using Microsoft.EntityFrameworkCore; @@ -35,6 +36,8 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) { PlatformDbContext dbContext = scope.ServiceProvider.GetRequiredService(); await dbContext.Database.MigrateAsync(deadline.Token); + IdentityDbContext identityDbContext = scope.ServiceProvider.GetRequiredService(); + await identityDbContext.Database.MigrateAsync(deadline.Token); } deadline.Token.ThrowIfCancellationRequested(); diff --git a/src/ChessRealms.Platform.MigrationWorker/packages.lock.json b/src/ChessRealms.Platform.MigrationWorker/packages.lock.json index 0911f34..bae352a 100644 --- a/src/ChessRealms.Platform.MigrationWorker/packages.lock.json +++ b/src/ChessRealms.Platform.MigrationWorker/packages.lock.json @@ -32,6 +32,19 @@ "Microsoft.Extensions.Options": "10.0.15" } }, + "Microsoft.AspNetCore.Cryptography.Internal": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "QsgH1P7/bDthx8inoa659//xBmWyKQri+NxQz9X7TgubhQzNL/eZllbay0jB2LXoxf3i1BJ8xgdNzyUqZuwhTw==" + }, + "Microsoft.AspNetCore.Cryptography.KeyDerivation": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "egaMlQze3SMaBjwhzwU05K8KbJ3Il5XRTkTyC85HREzrbpJr42oFKXTvZYmxIEFRrQATBV5uwPCjFY2ujhL3dg==", + "dependencies": { + "Microsoft.AspNetCore.Cryptography.Internal": "10.0.15" + } + }, "Microsoft.EntityFrameworkCore.Abstractions": { "type": "Transitive", "resolved": "10.0.15", @@ -295,6 +308,27 @@ "Microsoft.Extensions.Telemetry": "10.11.0" } }, + "Microsoft.Extensions.Identity.Core": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "XMr9hhUFL/9IeOCsaLxJH974n+cYDWs3NpDwliXcvIHFoVlcNdr5/kPPeRYz1IDxW35WBbo9w3mYfYhJJtJ6mA==", + "dependencies": { + "Microsoft.AspNetCore.Cryptography.KeyDerivation": "10.0.15", + "Microsoft.Extensions.Diagnostics": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15" + } + }, + "Microsoft.Extensions.Identity.Stores": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "IEnTqSkIZk7Rq9eUkV0Z/tgQD37AITOKB1xp38xPrKf9Bm9de3h8SrNvz6YWUOlAibMRYDzQUw9qqmIiKFsWHA==", + "dependencies": { + "Microsoft.Extensions.Caching.Abstractions": "10.0.15", + "Microsoft.Extensions.Identity.Core": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15" + } + }, "Microsoft.Extensions.Logging": { "type": "Transitive", "resolved": "10.0.15", @@ -562,6 +596,7 @@ "dependencies": { "Aspire.Npgsql.EntityFrameworkCore.PostgreSQL": "[13.6.5, )", "ChessRealms.Platform.Application": "[1.0.0, )", + "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.15, )", "Microsoft.EntityFrameworkCore": "[10.0.15, )", "Microsoft.EntityFrameworkCore.Relational": "[10.0.15, )", "Npgsql.EntityFrameworkCore.PostgreSQL": "[10.0.3, )" @@ -603,6 +638,16 @@ "OpenTelemetry.Extensions.Hosting": "1.17.0" } }, + "Microsoft.AspNetCore.Identity.EntityFrameworkCore": { + "type": "CentralTransitive", + "requested": "[10.0.15, )", + "resolved": "10.0.15", + "contentHash": "vazYMsviWu/+efWfWiD95ZHZZ/SUf10MAfWeJ8ADK8oa5SjLO41NE7ii0eVQhHqWBBXh4s0zMQor2F8J25Oh5g==", + "dependencies": { + "Microsoft.EntityFrameworkCore.Relational": "10.0.15", + "Microsoft.Extensions.Identity.Stores": "10.0.15" + } + }, "Microsoft.EntityFrameworkCore": { "type": "CentralTransitive", "requested": "[10.0.15, )", diff --git a/tests/ChessRealms.Platform.Api.Tests/packages.lock.json b/tests/ChessRealms.Platform.Api.Tests/packages.lock.json index 6e9cfe7..6191244 100644 --- a/tests/ChessRealms.Platform.Api.Tests/packages.lock.json +++ b/tests/ChessRealms.Platform.Api.Tests/packages.lock.json @@ -32,6 +32,19 @@ "resolved": "2.23.0", "contentHash": "nWArUZTdU7iqZLycLKWe0TDms48KKGE6pONH2terYNa8REXiqixrMOkf1sk5DHGMaUTqONU2YkS4SAXBhLStgw==" }, + "Microsoft.AspNetCore.Cryptography.Internal": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "QsgH1P7/bDthx8inoa659//xBmWyKQri+NxQz9X7TgubhQzNL/eZllbay0jB2LXoxf3i1BJ8xgdNzyUqZuwhTw==" + }, + "Microsoft.AspNetCore.Cryptography.KeyDerivation": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "egaMlQze3SMaBjwhzwU05K8KbJ3Il5XRTkTyC85HREzrbpJr42oFKXTvZYmxIEFRrQATBV5uwPCjFY2ujhL3dg==", + "dependencies": { + "Microsoft.AspNetCore.Cryptography.Internal": "10.0.15" + } + }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", "resolved": "6.0.0", @@ -93,11 +106,11 @@ }, "Microsoft.Extensions.Configuration": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "UcnvaEaMvRckDDhyqY1OZkFwBqpZArkHFKB6dWaQWT9XTuNttNNX8Cqsb/Sic2LfJxsMLJUXnYrxY3iX5LN9pQ==", + "resolved": "10.0.15", + "contentHash": "XwGgzRlryUvICZbY/oNlR1MbFDYg6gePDoW38RyUis8vEAVKIHvMy9di5dujK6dObbUOQJpHtrjUZ2rU0V7RvQ==", "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.14", - "Microsoft.Extensions.Primitives": "10.0.14" + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.Primitives": "10.0.15" } }, "Microsoft.Extensions.Configuration.Abstractions": { @@ -110,11 +123,11 @@ }, "Microsoft.Extensions.Configuration.Binder": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "brDb5kgle2iY2lWHgeV/KOqnBEpVnlMFigGJ/WW7KP9Nj6C/t53f/h5boYyVXB0bEhgpL+ctbewDJMI+zAMj1w==", + "resolved": "10.0.15", + "contentHash": "VOjlZlv9b3woS1TcI8Ts1r2IsmsT7hqkx7o2sMSNzE5fPBGKfhJszlEIhtQVzUz4H8Uw/7Jtuj9x7wGlCUsi2A==", "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.14", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.14" + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15" } }, "Microsoft.Extensions.Configuration.EnvironmentVariables": { @@ -149,21 +162,21 @@ }, "Microsoft.Extensions.Diagnostics": { "type": "Transitive", - "resolved": "10.0.13", - "contentHash": "J9ODOrffj1mK3Et69elNsLGRguesPxvThTdVpFmQX7fLNPhIOgqHQfLdGnTBEwNAV3yf8yiyVlpDZNw2qN87Nw==", + "resolved": "10.0.15", + "contentHash": "+FK6gPJDZ+8abQ7WAXUSxK7jgwhATzHlt3TCiO/paVwx9I8VsdHHoapugUUZNHr0Re2UFDoxpPpCp5kp6TX5iQ==", "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.13", - "Microsoft.Extensions.Diagnostics.Abstractions": "10.0.13", - "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.13" + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Diagnostics.Abstractions": "10.0.15", + "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.15" } }, "Microsoft.Extensions.Diagnostics.Abstractions": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "vm+PPso6vOwGeX52MdOPh6z/R6KHgxQUwqq7k7Jc9jhy2JOxO2KB4xfoJQBBp2Ni8M4zKgJ4r2a1dgrYG7+MKw==", + "resolved": "10.0.15", + "contentHash": "oD1xl7uoHGnVuCEo3bjj1W3cVTMe55QVdkeis9YYdcnLfU42X58XTx6A1Sl7kiqp5LbzVrUvdy7F/mNKaOnpLg==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14", - "Microsoft.Extensions.Options": "10.0.14" + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15" } }, "Microsoft.Extensions.Diagnostics.ExceptionSummarization": { @@ -247,6 +260,27 @@ "Microsoft.Extensions.Telemetry": "10.11.0" } }, + "Microsoft.Extensions.Identity.Core": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "XMr9hhUFL/9IeOCsaLxJH974n+cYDWs3NpDwliXcvIHFoVlcNdr5/kPPeRYz1IDxW35WBbo9w3mYfYhJJtJ6mA==", + "dependencies": { + "Microsoft.AspNetCore.Cryptography.KeyDerivation": "10.0.15", + "Microsoft.Extensions.Diagnostics": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15" + } + }, + "Microsoft.Extensions.Identity.Stores": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "IEnTqSkIZk7Rq9eUkV0Z/tgQD37AITOKB1xp38xPrKf9Bm9de3h8SrNvz6YWUOlAibMRYDzQUw9qqmIiKFsWHA==", + "dependencies": { + "Microsoft.Extensions.Caching.Abstractions": "10.0.15", + "Microsoft.Extensions.Identity.Core": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15" + } + }, "Microsoft.Extensions.Logging": { "type": "Transitive", "resolved": "10.0.15", @@ -296,14 +330,14 @@ }, "Microsoft.Extensions.Options.ConfigurationExtensions": { "type": "Transitive", - "resolved": "10.0.13", - "contentHash": "xVO5HhATc09WXuS/RaDmx8ZeWS0mTpT1L0tkEDMSBHtAnNpNsDr0ge0wIO2jinCWWqpq5dL1tRTzpYNVlvyqLw==", + "resolved": "10.0.15", + "contentHash": "yQX7dFAHm9xKBh2TLiA3aTrmOkgEeMRoS7UM/XuVy3CpddaluUXDIMiM8na5q6JMesH8zt3bKIDu/3hkEhVo7Q==", "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.13", - "Microsoft.Extensions.Configuration.Binder": "10.0.13", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.13", - "Microsoft.Extensions.Options": "10.0.13", - "Microsoft.Extensions.Primitives": "10.0.13" + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.Configuration.Binder": "10.0.15", + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15", + "Microsoft.Extensions.Primitives": "10.0.15" } }, "Microsoft.Extensions.Primitives": { @@ -592,6 +626,7 @@ "dependencies": { "Aspire.Npgsql.EntityFrameworkCore.PostgreSQL": "[13.6.5, )", "ChessRealms.Platform.Application": "[1.0.0, )", + "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.15, )", "Microsoft.EntityFrameworkCore": "[10.0.15, )", "Microsoft.EntityFrameworkCore.Relational": "[10.0.15, )", "Npgsql.EntityFrameworkCore.PostgreSQL": "[10.0.3, )" @@ -633,6 +668,16 @@ "OpenTelemetry.Extensions.Hosting": "1.17.0" } }, + "Microsoft.AspNetCore.Identity.EntityFrameworkCore": { + "type": "CentralTransitive", + "requested": "[10.0.15, )", + "resolved": "10.0.15", + "contentHash": "vazYMsviWu/+efWfWiD95ZHZZ/SUf10MAfWeJ8ADK8oa5SjLO41NE7ii0eVQhHqWBBXh4s0zMQor2F8J25Oh5g==", + "dependencies": { + "Microsoft.EntityFrameworkCore.Relational": "10.0.15", + "Microsoft.Extensions.Identity.Stores": "10.0.15" + } + }, "Microsoft.AspNetCore.OpenApi": { "type": "CentralTransitive", "requested": "[10.0.15, )", diff --git a/tests/ChessRealms.Platform.Infrastructure.Tests/ChessRealms.Platform.Infrastructure.Tests.csproj b/tests/ChessRealms.Platform.Infrastructure.Tests/ChessRealms.Platform.Infrastructure.Tests.csproj index fefd44b..1076d1b 100644 --- a/tests/ChessRealms.Platform.Infrastructure.Tests/ChessRealms.Platform.Infrastructure.Tests.csproj +++ b/tests/ChessRealms.Platform.Infrastructure.Tests/ChessRealms.Platform.Infrastructure.Tests.csproj @@ -12,6 +12,8 @@ + + diff --git a/tests/ChessRealms.Platform.Infrastructure.Tests/IdentityPersistenceTests.cs b/tests/ChessRealms.Platform.Infrastructure.Tests/IdentityPersistenceTests.cs new file mode 100644 index 0000000..1c0ae50 --- /dev/null +++ b/tests/ChessRealms.Platform.Infrastructure.Tests/IdentityPersistenceTests.cs @@ -0,0 +1,95 @@ +using ChessRealms.Platform.Infrastructure.Identity; +using ChessRealms.Platform.Infrastructure.Identity.Persistence; +using ChessRealms.Platform.Infrastructure.Persistence; + +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +using Testcontainers.PostgreSql; + +using Xunit; + +namespace ChessRealms.Platform.Infrastructure.Tests; + +public sealed class IdentityPersistenceTests +{ + [Fact] + public async Task MigrationsAndIdentityStoresWorkWithPostgreSql() + { + CancellationToken cancellationToken = TestContext.Current.CancellationToken; + await using PostgreSqlContainer postgres = new PostgreSqlBuilder("postgres:18.3").Build(); + await postgres.StartAsync(cancellationToken); + + HostApplicationBuilder builder = Host.CreateEmptyApplicationBuilder(new HostApplicationBuilderSettings()); + builder.Configuration.AddInMemoryCollection(new Dictionary + { + ["ConnectionStrings:platform"] = postgres.GetConnectionString() + }); + builder.AddInfrastructure(); + using IHost host = builder.Build(); + + Guid userId; + const string password = "Integration-test-Password9!"; + await using (AsyncServiceScope scope = host.Services.CreateAsyncScope()) + { + PlatformDbContext platform = scope.ServiceProvider.GetRequiredService(); + IdentityDbContext identity = scope.ServiceProvider.GetRequiredService(); + await platform.Database.MigrateAsync(cancellationToken); + await identity.Database.MigrateAsync(cancellationToken); + // A second worker run must be safe and both snapshots must match their models. + await platform.Database.MigrateAsync(cancellationToken); + await identity.Database.MigrateAsync(cancellationToken); + Assert.False(platform.Database.HasPendingModelChanges()); + Assert.False(identity.Database.HasPendingModelChanges()); + Assert.Empty(await identity.Database.GetPendingMigrationsAsync(cancellationToken)); + + UserManager users = scope.ServiceProvider.GetRequiredService>(); + PlatformUser user = new() { UserName = "player", Email = "player@example.test" }; + IdentityResult created = await users.CreateAsync(user, password); + Assert.True(created.Succeeded, string.Join(", ", created.Errors.Select(error => error.Description))); + Assert.NotEqual(Guid.Empty, user.Id); + Assert.NotEqual(password, user.PasswordHash); + userId = user.Id; + + IdentityResult duplicate = await users.CreateAsync(new PlatformUser + { + UserName = "another-player", Email = "PLAYER@example.test" + }, password); + Assert.False(duplicate.Succeeded); + Assert.Contains(duplicate.Errors, error => error.Code == "DuplicateEmail"); + } + + await using (AsyncServiceScope scope = host.Services.CreateAsyncScope()) + { + UserManager users = scope.ServiceProvider.GetRequiredService>(); + PlatformUser? user = await users.FindByEmailAsync("PLAYER@example.test"); + Assert.NotNull(user); + Assert.Equal(userId, user.Id); + Assert.True(await users.CheckPasswordAsync(user, password)); + Assert.False(await users.CheckPasswordAsync(user, "wrong-password")); + Assert.False(user.EmailConfirmed); + Assert.True(users.Options.SignIn.RequireConfirmedEmail); + + IdentityDbContext identity = scope.ServiceProvider.GetRequiredService(); + identity.Users.Add(new PlatformUser + { + UserName = "race-player", NormalizedUserName = "RACE-PLAYER", + Email = "player@example.test", NormalizedEmail = "PLAYER@EXAMPLE.TEST" + }); + // Database uniqueness also protects against concurrent registrations. + await Assert.ThrowsAsync(() => identity.SaveChangesAsync(cancellationToken)); + identity.ChangeTracker.Clear(); + + await identity.GetService().MigrateAsync("0", cancellationToken); + PlatformDbContext platform = scope.ServiceProvider.GetRequiredService(); + Assert.Single(await platform.Database.GetAppliedMigrationsAsync(cancellationToken)); + await identity.Database.MigrateAsync(cancellationToken); + Assert.Empty(await identity.Users.ToListAsync(cancellationToken)); + } + } +} diff --git a/tests/ChessRealms.Platform.Infrastructure.Tests/packages.lock.json b/tests/ChessRealms.Platform.Infrastructure.Tests/packages.lock.json index 2d7e11a..b79f7c6 100644 --- a/tests/ChessRealms.Platform.Infrastructure.Tests/packages.lock.json +++ b/tests/ChessRealms.Platform.Infrastructure.Tests/packages.lock.json @@ -2,6 +2,36 @@ "version": 2, "dependencies": { "net10.0": { + "Microsoft.Extensions.Hosting": { + "type": "Direct", + "requested": "[10.0.15, )", + "resolved": "10.0.15", + "contentHash": "czDs4dncBxTiQ9geO0UWRx6RTfLugUT0WLsIAH7DEw/ebMpkIrLsnfyr7gG9TX0q4qM2GnTtxzxiZvGv+eqvFg==", + "dependencies": { + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.Configuration.Binder": "10.0.15", + "Microsoft.Extensions.Configuration.CommandLine": "10.0.15", + "Microsoft.Extensions.Configuration.EnvironmentVariables": "10.0.15", + "Microsoft.Extensions.Configuration.FileExtensions": "10.0.15", + "Microsoft.Extensions.Configuration.Json": "10.0.15", + "Microsoft.Extensions.Configuration.UserSecrets": "10.0.15", + "Microsoft.Extensions.DependencyInjection": "10.0.15", + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Diagnostics": "10.0.15", + "Microsoft.Extensions.FileProviders.Abstractions": "10.0.15", + "Microsoft.Extensions.FileProviders.Physical": "10.0.15", + "Microsoft.Extensions.Hosting.Abstractions": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15", + "Microsoft.Extensions.Logging.Abstractions": "10.0.15", + "Microsoft.Extensions.Logging.Configuration": "10.0.15", + "Microsoft.Extensions.Logging.Console": "10.0.15", + "Microsoft.Extensions.Logging.Debug": "10.0.15", + "Microsoft.Extensions.Logging.EventLog": "10.0.15", + "Microsoft.Extensions.Logging.EventSource": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15" + } + }, "Microsoft.NET.Test.Sdk": { "type": "Direct", "requested": "[18.12.0, )", @@ -12,6 +42,15 @@ "Microsoft.TestPlatform.TestHost": "18.12.0" } }, + "Testcontainers.PostgreSql": { + "type": "Direct", + "requested": "[4.14.0, )", + "resolved": "4.14.0", + "contentHash": "OPHWR9oCW89yuNxJjUo8Xtwrk0bcOdzFOE2Ryo01GAf/3WEzD+0j0gmdKSxx5kBprCdlbXurBJyaV7nSLPyWKQ==", + "dependencies": { + "Testcontainers": "4.14.0" + } + }, "xunit.runner.visualstudio": { "type": "Direct", "requested": "[4.0.1, )", @@ -27,11 +66,90 @@ "xunit.v3.mtp-v1": "[3.2.2]" } }, + "BouncyCastle.Cryptography": { + "type": "Transitive", + "resolved": "2.7.0", + "contentHash": "U+12df8UEWHgBi04YVf/Lgi2dy3SItlIYvHjjEVa/BngCQIzDCDRBk50DDByCfDvSbe5pRNFr3b7UrVK2kMcLw==" + }, + "Docker.DotNet.Enhanced": { + "type": "Transitive", + "resolved": "4.3.3", + "contentHash": "nGicLwvd42FhRk+khY5uS6cx49ErNdwYKnYBg0F4m4BDKLp/R77AVmmN9xAiqI3W/wN5ZCHkdUhgxf5ORkZuFQ==", + "dependencies": { + "Docker.DotNet.Enhanced.Handler.Abstractions": "4.3.3", + "Docker.DotNet.Enhanced.LegacyHttp": "4.3.3", + "Docker.DotNet.Enhanced.NPipe": "4.3.3", + "Docker.DotNet.Enhanced.NativeHttp": "4.3.3", + "Docker.DotNet.Enhanced.Unix": "4.3.3", + "Microsoft.Extensions.Logging.Abstractions": "8.0.3" + } + }, + "Docker.DotNet.Enhanced.Handler.Abstractions": { + "type": "Transitive", + "resolved": "4.3.3", + "contentHash": "9Cp8hOgtynixcDoAs9lnEaQosluojSYmiW3fsLsLIVfZjlq/fznSIZNUhnmyT4Xo1Iyuok/y49WL/25O47u0Pw==", + "dependencies": { + "Microsoft.Extensions.Logging.Abstractions": "8.0.3" + } + }, + "Docker.DotNet.Enhanced.LegacyHttp": { + "type": "Transitive", + "resolved": "4.3.3", + "contentHash": "7j3M16emv9PAQN7VwFn23xLYNj8GJmwPOcogveHkaWnOCqiC+anRaNKQwqIBNApM1AuwZKivehTKTPmmrjUUnw==", + "dependencies": { + "Docker.DotNet.Enhanced.Handler.Abstractions": "4.3.3" + } + }, + "Docker.DotNet.Enhanced.NativeHttp": { + "type": "Transitive", + "resolved": "4.3.3", + "contentHash": "iNzK+jRFeEMobSA7l/h4ARwCKOOefOWtVN5/RB0ft6/6H6IQXvVUuOgGyZAjYLBT7TsyClRYno2B904f3dtBuQ==", + "dependencies": { + "Docker.DotNet.Enhanced.Handler.Abstractions": "4.3.3" + } + }, + "Docker.DotNet.Enhanced.NPipe": { + "type": "Transitive", + "resolved": "4.3.3", + "contentHash": "ZTLYufuEfY0e6qLOgeH9QgXx2KYuoABRVaY5A8rsggyLgYqbDj9rCRfVAhHPCUv83S7pVxDHy+Tvm/BnxjWVpg==", + "dependencies": { + "Docker.DotNet.Enhanced.Handler.Abstractions": "4.3.3" + } + }, + "Docker.DotNet.Enhanced.Unix": { + "type": "Transitive", + "resolved": "4.3.3", + "contentHash": "ypo8qNbmvHw1t9VfpRTMogCw2vht6VjkXzlGYUUeP2H2bf83USURdla1maW1njn2oq2rfLUFOGMfmt+A37QU2w==", + "dependencies": { + "Docker.DotNet.Enhanced.Handler.Abstractions": "4.3.3" + } + }, + "Docker.DotNet.Enhanced.X509": { + "type": "Transitive", + "resolved": "4.3.3", + "contentHash": "oBDibWezEv4hgj3RIQxI3DVcxkNV1MdrD0d/jhjUu+h3DL+qc0wlkQva15kkwMatXmC/hWp1VP0DMoFXe+BmEw==", + "dependencies": { + "Docker.DotNet.Enhanced.Handler.Abstractions": "4.3.3" + } + }, "Microsoft.ApplicationInsights": { "type": "Transitive", "resolved": "2.23.0", "contentHash": "nWArUZTdU7iqZLycLKWe0TDms48KKGE6pONH2terYNa8REXiqixrMOkf1sk5DHGMaUTqONU2YkS4SAXBhLStgw==" }, + "Microsoft.AspNetCore.Cryptography.Internal": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "QsgH1P7/bDthx8inoa659//xBmWyKQri+NxQz9X7TgubhQzNL/eZllbay0jB2LXoxf3i1BJ8xgdNzyUqZuwhTw==" + }, + "Microsoft.AspNetCore.Cryptography.KeyDerivation": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "egaMlQze3SMaBjwhzwU05K8KbJ3Il5XRTkTyC85HREzrbpJr42oFKXTvZYmxIEFRrQATBV5uwPCjFY2ujhL3dg==", + "dependencies": { + "Microsoft.AspNetCore.Cryptography.Internal": "10.0.15" + } + }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", "resolved": "6.0.0", @@ -74,11 +192,11 @@ }, "Microsoft.Extensions.Configuration": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "UcnvaEaMvRckDDhyqY1OZkFwBqpZArkHFKB6dWaQWT9XTuNttNNX8Cqsb/Sic2LfJxsMLJUXnYrxY3iX5LN9pQ==", + "resolved": "10.0.15", + "contentHash": "XwGgzRlryUvICZbY/oNlR1MbFDYg6gePDoW38RyUis8vEAVKIHvMy9di5dujK6dObbUOQJpHtrjUZ2rU0V7RvQ==", "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.14", - "Microsoft.Extensions.Primitives": "10.0.14" + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.Primitives": "10.0.15" } }, "Microsoft.Extensions.Configuration.Abstractions": { @@ -91,20 +209,63 @@ }, "Microsoft.Extensions.Configuration.Binder": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "brDb5kgle2iY2lWHgeV/KOqnBEpVnlMFigGJ/WW7KP9Nj6C/t53f/h5boYyVXB0bEhgpL+ctbewDJMI+zAMj1w==", + "resolved": "10.0.15", + "contentHash": "VOjlZlv9b3woS1TcI8Ts1r2IsmsT7hqkx7o2sMSNzE5fPBGKfhJszlEIhtQVzUz4H8Uw/7Jtuj9x7wGlCUsi2A==", "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.14", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.14" + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15" + } + }, + "Microsoft.Extensions.Configuration.CommandLine": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "5m3XbJnN5g8WMEIqrqpTK8/Xeq+dnmINaRvDUDCWN/J+v9795p/D9brr7597sBnmp2Hqg7/g9i6KbXSWjHQ1cA==", + "dependencies": { + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15" } }, "Microsoft.Extensions.Configuration.EnvironmentVariables": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "jB0UiYjpnneoBH1ZeXPlHYt4zUme6SZlnstL6gsH/0O/d5rOuN5lSIlOIfxXzapl8tAi7QmYOEogP09g/wcHzA==", + "resolved": "10.0.15", + "contentHash": "Acq0muvpN1QfTGV5eJiuutef5Gd1nWxa9aE6CzlmAGJdgPooR/glwkjY4cTWWZgXSVpfaOEe8AQjRO6xdDrDyQ==", "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.14", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.14" + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15" + } + }, + "Microsoft.Extensions.Configuration.FileExtensions": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "zA3VutAch9qe/WcKfVRXnivIMdAeZsxWVbFDO6Z9P6NQdNH73SXrULoH7PYfdC+CBsLiMKvx6z4oTjAvuKPGpA==", + "dependencies": { + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.FileProviders.Abstractions": "10.0.15", + "Microsoft.Extensions.FileProviders.Physical": "10.0.15", + "Microsoft.Extensions.Primitives": "10.0.15" + } + }, + "Microsoft.Extensions.Configuration.Json": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "5+FOOsKnE3Vf/q2yIHL+gljoJbmT8WB9vuXeJfXNav14OBCmn5wuQM6Fs3y0mxmRvQVRQvfzmpSvaXRXJBfDdw==", + "dependencies": { + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.Configuration.FileExtensions": "10.0.15", + "Microsoft.Extensions.FileProviders.Abstractions": "10.0.15" + } + }, + "Microsoft.Extensions.Configuration.UserSecrets": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "P4gX89ewSSE4UElThXKUmapXpRb3RwaL2jDqvUy9wn30T757mxozGV+xb5H4Fdm01dMHXTzA/Zj1NUInltqCPg==", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.Configuration.Json": "10.0.15", + "Microsoft.Extensions.FileProviders.Abstractions": "10.0.15", + "Microsoft.Extensions.FileProviders.Physical": "10.0.15" } }, "Microsoft.Extensions.DependencyInjection": { @@ -120,13 +281,23 @@ "resolved": "10.0.15", "contentHash": "KczR2nV7ooeimtZxAawPht/FJUHnX+uoWy7y4pba+iaRQBwUM2NwtiqZg+/FpZDHUf2RkkzveGkhMTWDNzmDUA==" }, + "Microsoft.Extensions.Diagnostics": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "+FK6gPJDZ+8abQ7WAXUSxK7jgwhATzHlt3TCiO/paVwx9I8VsdHHoapugUUZNHr0Re2UFDoxpPpCp5kp6TX5iQ==", + "dependencies": { + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Diagnostics.Abstractions": "10.0.15", + "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.15" + } + }, "Microsoft.Extensions.Diagnostics.Abstractions": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "vm+PPso6vOwGeX52MdOPh6z/R6KHgxQUwqq7k7Jc9jhy2JOxO2KB4xfoJQBBp2Ni8M4zKgJ4r2a1dgrYG7+MKw==", + "resolved": "10.0.15", + "contentHash": "oD1xl7uoHGnVuCEo3bjj1W3cVTMe55QVdkeis9YYdcnLfU42X58XTx6A1Sl7kiqp5LbzVrUvdy7F/mNKaOnpLg==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14", - "Microsoft.Extensions.Options": "10.0.14" + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15" } }, "Microsoft.Extensions.Diagnostics.HealthChecks": { @@ -157,22 +328,58 @@ }, "Microsoft.Extensions.FileProviders.Abstractions": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "rAqf2Em2ZjLqNbcLJlboQnXNyJP604F960TsCKNiP00Ur6ExIc1mcwmNb8L2eTRT8RC8UKx/GjecoWcW2Sj7bw==", + "resolved": "10.0.15", + "contentHash": "1RSYAUtJeb76m2T0u5BbvwKY3s+ge9fT3cj1odvo5Bm+frc7pU9RSeXeMIlYHV8GjpqLdv2neeeomz010yYL8A==", + "dependencies": { + "Microsoft.Extensions.Primitives": "10.0.15" + } + }, + "Microsoft.Extensions.FileProviders.Physical": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "2hOXuMZ//9h6foRT4KzcrooXNpf9GC6uk1p41kRHiSiVNNHwEeLywqafzHv+rjxKcN5+Ld9ZjnZayxRCgp+nAQ==", "dependencies": { - "Microsoft.Extensions.Primitives": "10.0.14" + "Microsoft.Extensions.FileProviders.Abstractions": "10.0.15", + "Microsoft.Extensions.FileSystemGlobbing": "10.0.15", + "Microsoft.Extensions.Primitives": "10.0.15" } }, + "Microsoft.Extensions.FileSystemGlobbing": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "2Vc8lDEufnkNpp/8Q3mP77Hz2BnPhuKzj9MiMTINiRJ23gCudPewm3yQdxvBbWpZZw68PxQ61CZMo0rS/WwDAg==" + }, "Microsoft.Extensions.Hosting.Abstractions": { "type": "Transitive", - "resolved": "10.0.14", - "contentHash": "p6NUEkmlaB+FujQZTtyNBKFULQO+Fj8SKuYdYHASQso+RkeYdFDPNsMM4mtOHqx1GZNQnZm/inmsqGkja/Dw2w==", + "resolved": "10.0.15", + "contentHash": "s/JBiwR3F/vKRCbe6WO5b6t6or1ISaZ3rllchcw6/FSWZmK8s2fAzD7elrZo7592FnMD1fhGoG/wuJL1YYtVXw==", "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.14", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.14", - "Microsoft.Extensions.Diagnostics.Abstractions": "10.0.14", - "Microsoft.Extensions.FileProviders.Abstractions": "10.0.14", - "Microsoft.Extensions.Logging.Abstractions": "10.0.14" + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Diagnostics.Abstractions": "10.0.15", + "Microsoft.Extensions.FileProviders.Abstractions": "10.0.15", + "Microsoft.Extensions.Logging.Abstractions": "10.0.15" + } + }, + "Microsoft.Extensions.Identity.Core": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "XMr9hhUFL/9IeOCsaLxJH974n+cYDWs3NpDwliXcvIHFoVlcNdr5/kPPeRYz1IDxW35WBbo9w3mYfYhJJtJ6mA==", + "dependencies": { + "Microsoft.AspNetCore.Cryptography.KeyDerivation": "10.0.15", + "Microsoft.Extensions.Diagnostics": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15" + } + }, + "Microsoft.Extensions.Identity.Stores": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "IEnTqSkIZk7Rq9eUkV0Z/tgQD37AITOKB1xp38xPrKf9Bm9de3h8SrNvz6YWUOlAibMRYDzQUw9qqmIiKFsWHA==", + "dependencies": { + "Microsoft.Extensions.Caching.Abstractions": "10.0.15", + "Microsoft.Extensions.Identity.Core": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15" } }, "Microsoft.Extensions.Logging": { @@ -195,17 +402,63 @@ }, "Microsoft.Extensions.Logging.Configuration": { "type": "Transitive", - "resolved": "10.0.0", - "contentHash": "j8zcwhS6bYB6FEfaY3nYSgHdpiL2T+/V3xjpHtslVAegyI1JUbB9yAt/BFdvZdsNbY0Udm4xFtvfT/hUwcOOOg==", + "resolved": "10.0.15", + "contentHash": "Km6Ml1/nu0T/f80Btonxf9CWmP/BXI84aJwC5fUbCxRArJ0lH++0ADQrjErZvsSIrKhusTkTSGBChKy2fYAF4w==", "dependencies": { - "Microsoft.Extensions.Configuration": "10.0.0", - "Microsoft.Extensions.Configuration.Abstractions": "10.0.0", - "Microsoft.Extensions.Configuration.Binder": "10.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.0", - "Microsoft.Extensions.Logging": "10.0.0", - "Microsoft.Extensions.Logging.Abstractions": "10.0.0", - "Microsoft.Extensions.Options": "10.0.0", - "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.0" + "Microsoft.Extensions.Configuration": "10.0.15", + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.Configuration.Binder": "10.0.15", + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15", + "Microsoft.Extensions.Logging.Abstractions": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15", + "Microsoft.Extensions.Options.ConfigurationExtensions": "10.0.15" + } + }, + "Microsoft.Extensions.Logging.Console": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "3PPlRrxB8B5KH902aSRCm0J9jjbYp24qet1+NZabAPaW0wIxRUL5jyB+8l2b85Y8VfsN2dhnutrdEkVvstVr5A==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15", + "Microsoft.Extensions.Logging.Abstractions": "10.0.15", + "Microsoft.Extensions.Logging.Configuration": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15" + } + }, + "Microsoft.Extensions.Logging.Debug": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "vPvEpc4hq9maNykhz/PyCREgm82TvUJTzSM9Y3vXwGYS7AGSXvC7HkXiA9KM1nFhuHP9w4mHS7ZAhIUTxCwigA==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15", + "Microsoft.Extensions.Logging.Abstractions": "10.0.15" + } + }, + "Microsoft.Extensions.Logging.EventLog": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "U1I57mk4Nu4YRttw50tOprKxBGEjfv7Nm51MwnW2rUeVuO6UyFXlF0CV9aC+1npkShmkRYIj9C77KX2+/1jFSQ==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15", + "Microsoft.Extensions.Logging.Abstractions": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15", + "System.Diagnostics.EventLog": "10.0.15" + } + }, + "Microsoft.Extensions.Logging.EventSource": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "EbkZxaOGBDXqqdsIh7kGuFxqDoiLDWwgqG/WiqM4kpSJ9T9lSIyE6724R13T0ihhAc9VShTYZvjp9ug+rZ4GBQ==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Logging": "10.0.15", + "Microsoft.Extensions.Logging.Abstractions": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15", + "Microsoft.Extensions.Primitives": "10.0.15" } }, "Microsoft.Extensions.Options": { @@ -219,14 +472,14 @@ }, "Microsoft.Extensions.Options.ConfigurationExtensions": { "type": "Transitive", - "resolved": "10.0.0", - "contentHash": "tL9cSl3maS5FPzp/3MtlZI21ExWhni0nnUCF8HY4npTsINw45n9SNDbkKXBMtFyUFGSsQep25fHIDN4f/Vp3AQ==", + "resolved": "10.0.15", + "contentHash": "yQX7dFAHm9xKBh2TLiA3aTrmOkgEeMRoS7UM/XuVy3CpddaluUXDIMiM8na5q6JMesH8zt3bKIDu/3hkEhVo7Q==", "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "10.0.0", - "Microsoft.Extensions.Configuration.Binder": "10.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.0", - "Microsoft.Extensions.Options": "10.0.0", - "Microsoft.Extensions.Primitives": "10.0.0" + "Microsoft.Extensions.Configuration.Abstractions": "10.0.15", + "Microsoft.Extensions.Configuration.Binder": "10.0.15", + "Microsoft.Extensions.DependencyInjection.Abstractions": "10.0.15", + "Microsoft.Extensions.Options": "10.0.15", + "Microsoft.Extensions.Primitives": "10.0.15" } }, "Microsoft.Extensions.Primitives": { @@ -333,6 +586,37 @@ "OpenTelemetry.Api": "1.17.0" } }, + "SharpZipLib": { + "type": "Transitive", + "resolved": "1.4.2", + "contentHash": "yjj+3zgz8zgXpiiC3ZdF/iyTBbz2fFvMxZFEBPUcwZjIvXOf37Ylm+K58hqMfIBt5JgU/Z2uoUS67JmTLe973A==" + }, + "SSH.NET": { + "type": "Transitive", + "resolved": "2026.0.0", + "contentHash": "Yu9dirPq8l3oaat0+OQ7K0nUf5MmYltpia5UGqsApTG4zTPvBC1cxbNnC3NERij26dUST0A3Ef1QdHSn5ArbWQ==", + "dependencies": { + "BouncyCastle.Cryptography": "2.7.0", + "Microsoft.Extensions.Logging.Abstractions": "8.0.3" + } + }, + "System.Diagnostics.EventLog": { + "type": "Transitive", + "resolved": "10.0.15", + "contentHash": "d1ynyO/BvCyi8SI1m6/xASazxrZm20V/mTDJay4qmL947RsA5MEiMk1JWvafw6JX005VVBAHvjWQP1dRRBvYKw==" + }, + "Testcontainers": { + "type": "Transitive", + "resolved": "4.14.0", + "contentHash": "ojuBi91xcMsR6vnFuNsQDWU9tlZlrtmqy95VPNWVVnh24GiwFL/WMnVmb6bRv8LqovtnKPJN9cpmH1k02Z4ZoA==", + "dependencies": { + "Docker.DotNet.Enhanced": "4.3.3", + "Docker.DotNet.Enhanced.X509": "4.3.3", + "Microsoft.Extensions.Logging.Abstractions": "8.0.3", + "SSH.NET": "2026.0.0", + "SharpZipLib": "1.4.2" + } + }, "xunit.analyzers": { "type": "Transitive", "resolved": "1.27.0", @@ -414,6 +698,7 @@ "dependencies": { "Aspire.Npgsql.EntityFrameworkCore.PostgreSQL": "[13.6.5, )", "ChessRealms.Platform.Application": "[1.0.0, )", + "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "[10.0.15, )", "Microsoft.EntityFrameworkCore": "[10.0.15, )", "Microsoft.EntityFrameworkCore.Relational": "[10.0.15, )", "Npgsql.EntityFrameworkCore.PostgreSQL": "[10.0.3, )" @@ -443,6 +728,16 @@ "OpenTelemetry.Extensions.Hosting": "1.17.0" } }, + "Microsoft.AspNetCore.Identity.EntityFrameworkCore": { + "type": "CentralTransitive", + "requested": "[10.0.15, )", + "resolved": "10.0.15", + "contentHash": "vazYMsviWu/+efWfWiD95ZHZZ/SUf10MAfWeJ8ADK8oa5SjLO41NE7ii0eVQhHqWBBXh4s0zMQor2F8J25Oh5g==", + "dependencies": { + "Microsoft.EntityFrameworkCore.Relational": "10.0.15", + "Microsoft.Extensions.Identity.Stores": "10.0.15" + } + }, "Microsoft.EntityFrameworkCore": { "type": "CentralTransitive", "requested": "[10.0.15, )",