Skip to content

feat: real authentication for Identity (ASP.NET Core Identity + self-validated JWT) — slices 5.8–5.11#130

Merged
erikshafer merged 2 commits into
mainfrom
feat/identity-auth-slices-5-8-5-11
Jul 8, 2026
Merged

feat: real authentication for Identity (ASP.NET Core Identity + self-validated JWT) — slices 5.8–5.11#130
erikshafer merged 2 commits into
mainfrom
feat/identity-auth-slices-5-8-5-11

Conversation

@erikshafer

Copy link
Copy Markdown
Owner

erikshafer and others added 2 commits July 7, 2026 22:06
…elf-validated JWT) — slices 5.8–5.11

Closes the round-one auth stub (ADR 023). Identity becomes the system's sole auth
issuer: ASP.NET Core Identity for the user store + password handling on the existing
EF-Core/identity schema, minting an RS256 JWT (sub = customer id) signed with an
asymmetric private key it alone holds. Orders becomes a resource server, validating
the token fully offline against a config-distributed public key (zero HTTP into
Identity) and sourcing the customer id from sub. The X-Customer-Id header is retired
as the trust boundary — the sub claim replaces it — and survives only as a dev-only
fallback under a layered cutover, so the seeder, existing tests, and demo-traffic stay
green. The frontend cuts fully to Authorization: Bearer with login/register/logout UI,
session-token persistence, and browse-anon / checkout-gated routing.

Slices 5.8 (register with credentials), 5.9 (log in — issue a JWT), 5.10 (verify a
token at a resource server), 5.11 (log out — client-side discard). Still
non-event-sourced (relational user store extending the boring-CRUD foil; zero stream
events, no saga). AuthZ/roles, refresh tokens, and server-side revocation deferred.

Entity shape: two id-linked tables, one CustomerDbContext deriving
IdentityUserContext<IdentityUser> (renamed from IdentityDbContext, resolving the name
collision). Dev keypair shared via ServiceDefaults.DevJwtDefaults (prod overrides
Jwt:PrivateKey/Jwt:PublicKey).

Consolidated PR: OpenSpec change (proposal + customer-registry spec delta, 4 ADDED
requirements + design + tasks, validate --strict green), Narrative 010, prompt 037,
code, tests, retro. 172 backend + 112 frontend tests green; live-verified end-to-end
against the real Aspire stack (register → login → authenticated request → 401 on bad
token → 400 on no identity).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rmat CI)

The two new auth usings (Microsoft.AspNetCore.Authentication.JwtBearer,
Microsoft.IdentityModel.Tokens) were inserted before JasperFx.Events.Projections /
Marten instead of in alphabetical position. `dotnet format --verify-no-changes` now
passes clean across the whole solution.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@erikshafer erikshafer self-assigned this Jul 8, 2026
@erikshafer erikshafer merged commit beab235 into main Jul 8, 2026
4 checks passed
@erikshafer erikshafer deleted the feat/identity-auth-slices-5-8-5-11 branch July 8, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant