Expand MAUI Identity sample with REST account parity - #666
Draft
mattleibow wants to merge 14 commits into
Draft
mattleibow wants to merge 14 commits into
mattleibow wants to merge 14 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This draft explores what a fully featured, trusted first-party .NET MAUI client can do with ASP.NET Core Identity's in-box REST endpoints and opaque bearer tokens, without introducing OAuth/OIDC, JWTs, OpenIddict, or another third-party authorization server.
The sample keeps the stock
MapIdentityApi<ApplicationUser>()surface intact under/identity, adds enhanced replacement contracts under/identity-overrides, and adds only currently missing account-management routes under/identity. The additional endpoint implementation lives in a framework-reference-only class library so it can serve as concrete input for potential ASP.NET Core Identity improvements.How it works
Server endpoint composition
/identityroutes remain framework-owned and directly comparable.MapOverrideIdentityApi<TUser>provides richer contracts where an existing route lacks information needed by a native client.MapNewIdentityApi<TUser>adds account capabilities for whichMapIdentityApicurrently has no route.IdentityConstants.BearerScheme; normal Identity cookies continue to serve hosted Razor account pages.The tokens remain ASP.NET Core Identity Data Protection bearer tickets. They are opaque, not JWTs, and this is deliberately a first-party application pattern rather than an OAuth authorization server.
MAUI client
The MAUI client now uses typed REST calls for:
Token refresh is serialized, the access/refresh pair is persisted atomically, and an authentication epoch prevents an old login or refresh operation from restoring a session after logout or account switching. SecureStorage failures degrade safely to a memory-only or logged-out state rather than crashing the authentication lifecycle.
Passkeys and external providers
The server uses public ASP.NET Core Identity passkey APIs and the official temporary Identity ceremony cookie. The .NET 10 client displays sanitized registration options; native
CreateAsync/AssertAsynccompletion is intentionally deferred to the .NET 11 MAUI passkey API.External-provider discovery and safe unlinking are implemented. Browser challenge/callback/link handoff is deferred until a real provider can be configured rather than introducing a fake provider-specific flow.
Development email flow
Development replaces the no-op sender with a bounded, in-memory notification page. It allows confirmation and password-reset ceremonies to be exercised locally, is never persisted or logged, and is not mapped outside the Development environment. Production still requires a real
IEmailSender<ApplicationUser>.Test strategy
The change separates three levels of validation:
WebApplicationFactory, and SQLite for stock, override, and new REST contracts.Run the full stack with:
cd 10.0/MauiBlazorWebIdentity ./scripts/run-devflow-live-tests.shThe runner creates isolated SQLite state, starts the built server and Mac Catalyst executable, waits independently for the DevFlow agent and Blazor CDP bridge, runs all suites, and terminates only the exact processes it started. No Appium dependency is used.
Validated locally:
Known existing warnings for
Microsoft.OpenApiandSQLitePCLRaw.lib.e_sqlite3, plus host-dependent Mac Catalyst signing/provisioning, are documented and not changed here.Potential ASP.NET Core Identity improvements
The capability and route matrices in
IDENTITY_API_CAPABILITIES.mdidentify the following candidates for the in-box API surface:Machine-readable login outcomes
A richer and unambiguous account-info contract
First-class passkey REST ceremonies and management
Safe personal-data projection and deletion
Linked-provider management
Session/token management semantics
Configurable confirmation-link generation
These additions are implemented only with public
UserManager<TUser>andSignInManager<TUser>APIs and avoid MAUI-specific types, making the class library intentionally suitable for discussion or extraction into an ASP.NET Core contribution.Documentation
IDENTITY_API_CAPABILITIES.md— hosted-feature classification and per-route test matrix.IDENTITY_API_IMPLEMENTATION.md— implementation decisions, validation ledger, and known limitations.DEVFLOW_TESTING.md— server, Playwright, and live MAUI DevFlow test architecture and prerequisites.