Skip to content

Add the Identity foundation - #2441

Merged
pournasserian merged 1 commit into
v2from
2440-identity-foundation
Oct 17, 2026
Merged

pournasserian merged 1 commit into
v2from
2440-identity-foundation

Conversation

@pournasserian

Copy link
Copy Markdown
Member

Closes #2440

What

The part of F-USR (#2428) that needs no screen, so it lands before the admin shell.

  • Core: the initiator model from ADR-0009 (Initiator, UserInitiator, AgentInitiator, ICurrentInitiator) with ClaimsInitiator.From(principal), where an agent credential claim always wins over a user id so an agent can never be recorded as a person. FluentCmsRoles.Administrator, Result / Result<T> / Error, and the IFirstRunSetup and IUserDirectory services.
  • Infrastructure: ASP.NET Core Identity stores on EF Core (FluentCmsUser with display name, FluentCmsRole, Guid keys, tables named Users, Roles, ...). The DbContext is now an abstract IdentityDbContext with a SQLite and a PostgreSQL subclass, each with its own migrations folder and a design-time factory, selected once at startup by the existing provider configuration. The first migration, Identity, for both providers. UserDirectory (create, list, disable through lockout) and FirstRunSetup.
  • Host: ICurrentInitiator resolved from the request's claims in the web host; the stdio host has no initiator until F-MCP issues agent credentials.
  • Tooling: dotnet-ef as a local tool in .config/dotnet-tools.json; CONTRIBUTING.md documents how to add a migration for both providers.

Why

F-AUD (#2424) needs the principal model and sign-in needs the user store; neither needs a page. Landing the per-provider migration strategy now means the next epics add tables the same way.

Tests

Unit: claims mapping for a user, an agent beside a user id, and anonymous principals; result semantics. Integration: migrations apply on SQLite and on PostgreSQL in CI, the first administrator is created once and holds the Administrator role, users are created, listed and disabled, a weak password is rejected with Identity's error codes, and an unknown provider fails at startup. Both host modes still start, which now exercises the migrator with a real migration.

Checklist

  • Linked to an issue a maintainer has confirmed
  • Targets v2
  • Tests or docs updated where behaviour changed
  • No tool-generated co-author trailers or footers

Identity user store on EF Core with a SQLite and a PostgreSQL DbContext each carrying its own migrations, the first Identity migration for both, first-run administrator and user directory services, the user-or-agent initiator model, and dotnet-ef as a local tool.

Refs #2440
@pournasserian pournasserian added this to the M1 Governance core milestone Oct 17, 2026
@pournasserian pournasserian added type:feature New capability v2 FluentCMS v2 (v2 branch) area:users Users and sign-in (USR) labels Oct 17, 2026
@pournasserian
pournasserian merged commit 54b9719 into v2 Oct 17, 2026
2 checks passed
@pournasserian
pournasserian deleted the 2440-identity-foundation branch October 17, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:users Users and sign-in (USR) type:feature New capability v2 FluentCMS v2 (v2 branch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Identity foundation: user store, migrations for both providers, first administrator and initiator model

1 participant