Architecture Decision Record
ADR-139: Passkeys (WebAuthn) as an Opt-In Sign-In and Second Factor
Status
Accepted (2026-11-08). Ships in MMCA.Common v1.281.0 as a new package, MMCA.Common.Passkeys
(the package list and count are owned by MMCA.Common/FACTS.md). Off unless the host calls
AddPasskeys and sets Passkeys:Enabled
(MMCA.Common/Source/Core/MMCA.Common.Application/Auth/Passkeys/PasskeySettings.cs:24-25, default
false).
Amended 2026-11-12: MMCA.ADC is the first consumer to carry the code path,
switched off in production (see Consequences).
Revised 2026-11-23: a passkey sign-in mints through the private IssueTokensCoreAsync (the
issuance choke point), not the protected IssueTokensAsync wrapper that now runs a second-factor
challenge first; Fido2 is at 4.3.3; anchors refreshed.
Context
A password plus a TOTP code is phishable: a convincing proxy page collects both and replays them within the code's window. The only passwordless path the framework offered was the emailed sign-in link (ADR-116, item 14), which is as strong as the mailbox. Nothing in MMCA.Common spoke WebAuthn.
Five forces shaped the decision:
- The token path already has one choke point. Every interactive sign-in mints through the
private
AuthenticationServiceBase.IssueTokensCoreAsync, which refuses a service account and hands off toAuthSessionIssuer.IssueAsync(MMCA.Common/Source/Core/MMCA.Common.Application/Auth/AuthenticationServiceBase.cs:725-743), which opens a refresh session (ADR-097). The framework's own sign-ins call it directly (AuthenticationServiceBase.cs:281,:397,:585,:626); an app-level sign-in goes through the protectedIssueTokensAsyncwrapper, which runs the second-factor challenge first (AuthenticationServiceBase.cs:691-713). A new app-level sign-in method that mints throughIssueTokensAsync(and so reachesIssueTokensCoreAsync) inherits sessions, sign-in history and revocation with no second path. - The second-factor claim already exists.
mfais an amr-style claim whose presence is the assertion and whose value names the method (otp,recovery;MMCA.Common/Source/Core/MMCA.Common.Shared/Auth/AuthClaimTypes.cs:49-69), and a refresh carries it over (AuthenticationServiceBase.cs:445-450). - WebAuthn verification is security-critical parsing. Attestation and assertion verification means
CBOR, COSE keys, signature formats and origin binding. The maintained .NET library for it,
Fido2NetLib, pulls
NSec.Cryptographyand the native libsodium. - Native code stays out of the core. ADR-134 keeps third-party SDKs in adapter packages a host opts into, and every consumer references Infrastructure, so a dependency there ships in every host whether or not it uses passkeys.
- Common has no user entity. The user row is the app's (ADR-116), so a credential table owned by the framework has to key on the user id alone and ask the app whatever it needs to know about the account.
Decision
Passkeys are a framework opt-in: WebAuthn verification lives in its own package, credentials in a
gated framework table, and a passkey sign-in mints the normal token pair with mfa=passkey.
Registering a passkey needs an interactive sign-in under ten minutes old, judged by a new auth_time
claim. Web heads only.
- One package holds the WebAuthn library, behind a core contract.
MMCA.Common.Passkeysreferences Application and theFido2package and nothing else (MMCA.Common/Source/Core/MMCA.Common.Passkeys/MMCA.Common.Passkeys.csproj:7-13), at 4.3.3 (MMCA.Common/Directory.Packages.props:153; the comment at:148-152states why it is kept to one reviewed version and inside this package). The CPM entry is a bare version, which NuGet reads as a floor ([4.3.3, )); what holds it to 4.3.3 is the committed lock file (MMCA.Common/Source/Core/MMCA.Common.Passkeys/packages.lock.json:7-8) restored with--locked-modein CI (MMCA.Common/.github/workflows/ci.yml:146). It supplies the internalFido2PasskeyCeremonybehind the coreIPasskeyCeremony(MMCA.Common/Source/Core/MMCA.Common.Passkeys/Fido2PasskeyCeremony.cs:17). Two gates keep the boundary true:- Build time.
EnforcePasskeysBoundaryfails any otherMMCA.Common.*project that referencesMMCA.Common.Passkeysor declares aFido2,NSecorlibsodiumpackage reference (MMCA.Common/Source/Build/MMCA.Common.LayerEnforcement.targets:157-180). - Test time.
PasskeysIsolationTestsasserts that no core layer, nor Aspire, the testing packages or the MCP package, names a type fromMMCA.Common.Passkeys,Fido2NetLiborNSec, or references an assembly with those prefixes orlibsodium(MMCA.Common/Tests/Architecture/MMCA.Common.Architecture.Tests/Passkeys/PasskeysIsolationTests.cs:14-25,:29-50).
- Build time.
- One call registers it.
services.AddPasskeys(configuration)binds thePasskeyssection withValidateOnStartand a validator that names a missing key, and registers the ceremony, the challenge store andIPasskeyService(MMCA.Common/Source/Core/MMCA.Common.Passkeys/PasskeysServiceCollectionExtensions.cs:37-56). The section carriesEnabled,RelyingPartyId,RelyingPartyName,OriginsandDataSourceName(PasskeySettings.cs:24-46). - A startup tripwire catches the silent half-configuration.
Passkeys:Enabledtrue with noIPasskeyCeremonyregistered fails startup naming the package and the call (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Configuration/CloudAdapterTripwire.cs:42,:64-69), the same check native push already had, because without it every passkey route would answer 404 and nothing would say why. - Credentials live in a gated, hard-deleted framework table.
PasskeyCredentialis flat bookkeeping besideRefreshSession: no audit stamps, no soft-delete flag, deleted outright (MMCA.Common/Source/Core/MMCA.Common.Domain/Auth/PasskeyCredential.cs:8-14); the EF store removes the row (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Auth/EFPasskeyCredentialStore.cs:74-78). Nothing in the row is secret (PasskeyCredential.cs:15-18).PasskeyCredentialsis mapped only whilePasskeys:Enabledis true and only on the sourcePasskeys:DataSourceNamenames (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/DbContexts/ApplicationDbContext.cs:588-592,:1113-1118), the view-as grants shape;DesignTimeDbContextOptions.EnablePasskeysopens the same gate fordotnet ef(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/DbContexts/Design/DesignTimeDbContextOptions.cs:129). - Challenges are single-use, five minutes, in the shared store.
PasskeyChallenges.IssueAsyncstores the issued options under a random 32-hex flow id forLifetime(5 minutes), andRedeemAsyncreads and burns the entry insidelock:passkeys:challenge:{flowId}, reading the shared store so a flow burned on one replica misses on every other (MMCA.Common/Source/Core/MMCA.Common.Application/Auth/Passkeys/PasskeyChallenges.cs:24,:38-47,:56-83), the OAuth exchange-code pattern (ADR-036). - The signature counter must advance.
PasskeyCredential.IsSignCountAcceptableadmits a counter above the stored one, or zero on both sides (an authenticator that does not count, which synced passkeys are); anything else is a cloned key andRecordUserefuses it (PasskeyCredential.cs:114-146).PasskeyServiceapplies the rule itself as well as through the library, so it does not depend on the library's own check (MMCA.Common/Source/Core/MMCA.Common.Application/Auth/Passkeys/PasskeyService.cs:264-271). - A passkey sign-in is a normal sign-in with
mfa=passkey.AuthenticationServiceBase.SignInWithPasskeyAsyncruns the app's login-candidate check, sets the method toAuthClaimTypes.MultiFactorMethodPasskeyand mints throughIssueTokensCoreAsync(AuthenticationServiceBase.cs:603-632, candidate check:617-621, method:623, mint:626;AuthClaimTypes.cs:71-76), so the token pair, the refresh session and the sign-in history are the ones every other sign-in produces. A passkey is possession plus the authenticator's own user verification, so it satisfies the second factor itself, which is why it skips the second-factor challengeIssueTokensAsyncwould run (AuthenticationServiceBase.cs:596-600). Failures answer one vagueAssertionFailedto the caller and log the specific reason as a Warning with no key material (PasskeyService.cs:18-24,:277-281). - Registration needs a recent interactive sign-in, judged by
auth_time. Every interactive sign-in that opens a session stampsauth_time(Unix seconds), and a refresh carries it UNCHANGED (AuthClaimTypes.cs:98-111;AuthenticationServiceBase.cs:452-455;MMCA.Common/Source/Core/MMCA.Common.Application/Auth/Sessions/AuthSessionIssuer.cs:173-190).PasskeyStepUp.IsSatisfiedByadmits a caller whoseauth_timeis at mostMaxSignInAge(10 minutes) old; a token with noauth_timenever qualifies (MMCA.Common/Source/Core/MMCA.Common.Application/Auth/Passkeys/PasskeyStepUp.cs:6-30). Both registration actions check it (MMCA.Common/Source/Presentation/MMCA.Common.API/Controllers/Passkeys/PasskeysControllerBase.cs:81,:132). This is stricter than "a token under 10 minutes old, or one that carriesmfa": both of those ride every refresh (a refresh resetsiatand carriesmfaover), so either would let a stolen refresh token keep a session fresh enough to plant its own passkey indefinitely (PasskeyStepUp.cs:10-15). - The controller base.
PasskeysControllerBase(abstract; the app routes it atauth/passkeys) servesregister/optionsandregisterfor a signed-in caller,GET,PATCH {id}andDELETE {id}, and anonymoussignin/optionsandsigninon theauth-iprate-limit policy with discoverable credentials (PasskeysControllerBase.cs:41,:62-64,:110-112,:144-145,:170-171,:204-205,:229-232,:254-257). Every action answers 404 while passkeys are disabled (:54). The last passkey can be deleted only while the account still has a password or an external login, under a per-account lock so two concurrent deletes cannot both see "one more remains" (PasskeyService.cs:153-179;PasskeyChallenges.cs:92-94); the app answers the external half by overridingHasExternalLoginAsync, whichHasSignInMethodBesidesPasskeysAsyncasks (AuthenticationServiceBase.cs:640-652; the virtual at:654-664, default false). - One more token-issuing proxy path.
auth/passkeys/signinjoins the same-origin proxy's default token-issuing paths (MMCA.Common/Source/Presentation/MMCA.Common.UI.Web/SameOriginProxy/SameOriginApiProxySettings.cs:33, ADR-131). - Web only.
IPasskeyCapabilitydefaults toUnavailablePasskeyCapability, so a MAUI head hides the passkey button and the add-passkey action;AddBrowserDeviceCapabilitiesswaps in the browser implementation overpasskeys.js(MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:60,:119). The login page offers passkeys only whenSignIn:OfferPasskeysis true, the capability is available and anIPasskeyUIServiceis registered (MMCA.Common/Source/Presentation/MMCA.Common.UI/Pages/Auth/Login.razor.cs:196-203), and browser autofill asks for a challenge only where conditional mediation is available (MMCA.Common/Source/Presentation/MMCA.Common.UI/wwwroot/passkeys.js:137-143). - Service accounts never sign in with a passkey.
SignInWithPasskeyAsynctreats an account whoseIAuthUser.IsServiceAccountis true as vanished (AuthenticationServiceBase.cs:609-615; ADR-140).
Rationale
- A library over hand-rolled verification. The parsing is where WebAuthn implementations fail, and a maintained library with its own conformance work is the cheaper and safer owner of it.
- A separate package keeps native code where ADR-134 puts vendor code. A host that does not
reference
MMCA.Common.Passkeysrestores no Fido2, NSec or libsodium, and the core layers stay free of a native dependency; the two gates make that a build failure rather than a review comment. - The existing choke point and claim. Minting through
IssueTokensCoreAsyncwith a newmfavalue means sessions, sign-in history, revocation and everyIRequiresMfause case treat a passkey sign-in correctly with no change. auth_timemeasures the thing that matters. "Recently signed in" is a property of the sign-in, not of the access token; the claim that survives a refresh unchanged is the only one that cannot be kept fresh by refreshing.- Hard delete matches the meaning. A removed passkey must never sign in again; a soft-deleted row is one query-filter mistake from doing so, and the row is a public key, not an audit record.
Trade-offs
- A new third-party dependency in the auth path, with a native library behind it. Mitigated by the committed lock file restored in locked mode (decision 1), the package boundary and the fact that a host opts in by reference.
- Passkeys are bound to the relying party id. A credential registered under one
Passkeys:RelyingPartyIdis never offered for another, so a later domain change orphans every passkey (PasskeySettings.cs:13-17). The production domain has to be settled before the feature is turned on. - One gated table migration where enabled, on the Identity database only.
- Login protection does not meter passkey failures by account. Login protection is keyed by email,
which a discoverable sign-in does not carry before the assertion, so failures are metered per IP by
the
auth-ippolicy and logged as Warnings instead (PasskeyService.cs:19-24). - A token minted before the claim shipped cannot register a passkey until its holder signs in
again, because it has no
auth_time. - An app with external logins must override
HasExternalLoginAsync, or the last-passkey rule ignores the external login and refuses a delete it could allow.
Alternatives rejected
- Writing CBOR/COSE attestation and assertion verification ourselves (2026-11-08). A security-critical parser for no gain over a maintained library.
- ASP.NET Core Identity's passkey support (2026-11-08). It is built on Identity's
UserManagerand stores, which MMCA.Common does not use; the user row is the app's. - Fido2NetLib inside
MMCA.Common.Infrastructure(2026-11-08). Every host references Infrastructure, so every host would carry NSec and the native libsodium whether it offers passkeys or not. - Judging registration by token age, or by the presence of
mfa(2026-11-08). Both survive a refresh, so a stolen refresh token could keep either satisfied forever;auth_timecannot be refreshed. - A sign-in method column on
RefreshSession(2026-11-08). It would be a migration in every consumer's Identity database for a fact the token'smfavalue already carries. - MAUI native passkeys now (2026-11-08). Credential Manager on Android, associated domains on iOS and asset links for a need no user has raised. Recorded in the Enterprise-scale register of the Common backlog. Revisit: mobile users asking for passkeys, or a store-review requirement.
Consequences
- A host opts in by referencing
MMCA.Common.Passkeysfrom its Identity service, callingAddPasskeys, settingPasskeys:Enabled,Passkeys:RelyingPartyIdandPasskeys:Origins, adding thePasskeyCredentialsmigration withEnablePasskeys, routing aPasskeysControllerBasesubclass, settingSignIn:OfferPasskeysand placingPasskeysPanelon the profile page (MMCA.Common/UPGRADING.md:544-560). - MMCA.ADC is the first consumer to carry the code path, and carries it switched OFF in
production. Its Identity service references
the package (
MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/MMCA.ADC.Identity.Service.csproj:34) and callsAddPasskeys(MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Program.cs:190-194), but its baseappsettings.jsonsetsPasskeys:Enabledfalse (MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/appsettings.json:133-134). Only the service'sappsettings.Development.json(:33-34of that file) and the AppHost (MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:483-484) turn it on, and no file underMMCA.ADC/infra/setsPasskeysorSignIn:OfferPasskeys, so in production every passkey route answers 404 (PasskeysControllerBase.cs:53-54,:71-73).SignIn:OfferPasskeysis true only in the web head's Development settings (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/appsettings.Development.json:13) and through the AppHost (MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:486). The base web-head settings state it as false so the client config always carries it (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/appsettings.json:48-54), and the framework client-config endpoint forwards theSignInsection to the browser with no ADC line (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/Program.cs:117-124;:128on net11.0,:130-134on the gated net10.0 line), so the framework login page's passkey button and ADC's profile Passkeys card (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.UI/Pages/Users/Profile/Profile.razor:110) never render where it is false; the login button also needs an available passkey capability and a registered passkey UI service (Login.razor.cs:196-203). The controller is a sealedPasskeysControllerBasesubclass routed atauth/passkeys(MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.API/Controllers/Passkeys/PasskeysController.cs:19-21). TheAddPasskeyCredentialsmigration creates the onePasskeyCredentialstable with a unique index onCredentialIdand an index onUserId(MMCA.ADC/Source/Hosting/MMCA.ADC.Migrations.SqlServer.Identity/Migrations/20261112192534_AddPasskeyCredentials.cs:14-45), so once the migration runs the table exists, unused, while the switch is off (Program.cs:190-193of the Identity service). ADC also overridesHasExternalLoginAsync. Turning passkeys on in production waits on a decision about ADC's production domain, because a passkey is bound to the relying-party id (appsettings.json:129-130of the Identity service; recorded in the ADC backlog). Store and Helpdesk leave it off. MMCA.Common/FACTS.mdlists the new package.
Revision (2026-11-23)
Re-verified against current source. The package boundary, the gated hard-deleted table, the
single-use challenges, the signature-counter rule, mfa=passkey, the auth_time step-up, the
controller base, web-only capability and ADC's switched-off adoption are unchanged. What moved is the
name of the issuance choke point, the Fido2 version and most anchors.
- The choke point is
IssueTokensCoreAsync.IssueTokensAsyncis now a protected wrapper that runs a second-factor challenge with no code before issuing (MMCA.Common/Source/Core/MMCA.Common.Application/Auth/AuthenticationServiceBase.cs:691-713); the issuance itself is the privateIssueTokensCoreAsync, which refuses a service account and callsAuthSessionIssuer.IssueAsync(AuthenticationServiceBase.cs:725-743). The framework's own sign-ins call it directly (:281,:397,:585), and so doesSignInWithPasskeyAsync(:626), so a passkey sign-in deliberately skips the second-factor challenge (:596-600). Context, decision 7 and Rationale now name it. - Fido2 is at 4.3.3 (
MMCA.Common/Directory.Packages.props:153). The entry is a bare CPM version (a floor,[4.3.3, )inMMCA.Common/Source/Core/MMCA.Common.Passkeys/packages.lock.json:7), held to one version by the lock file and the CI--locked-moderestore (MMCA.Common/.github/workflows/ci.yml:146); decision 1 and Trade-offs say so. - The login gate names its third condition.
OffersPasskeys()also requires a registeredIPasskeyUIService(MMCA.Common/Source/Presentation/MMCA.Common.UI/Pages/Auth/Login.razor.cs:200-203); decision 11 now states it, as Consequences already did. - The web head forwards
SignInthrough the framework. ADC's web head has no line of its own forOfferPasskeys: the framework client-config endpoint forwards the host'sSignInsection (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/Program.cs:117-124;:128on net11.0,:130-134on net10.0), and the baseappsettings.jsonstates it as false (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI.Web/appsettings.json:54). - Anchors re-verified against current source:
AuthenticationServiceBase.cs:445-450(mfa carried on refresh),:452-455(auth_time carried),:603-632(SignInWithPasskeyAsync),:609-615(service account as vanished),:640-652and:654-664(HasExternalLoginAsync);AuthClaimTypes.cs:98-111(AuthTime);ApplicationDbContext.cs:588-592,:1113-1118;MMCA.Common.UI/Services/Capabilities/DependencyInjection.cs:60,:119;Login.razor.cs:196-203;MMCA.Common/UPGRADING.md:544-560;MMCA.ADC.Identity.Service.csproj:34; the Identity service'sProgram.cs:190-194;MMCA.ADC.AppHost/Program.cs:483-484,:486.
Related
ADR-036 (the exchange-code burn the challenge store copies),
ADR-050 (the rotation that carries mfa and auth_time),
ADR-097 (the sessions a passkey sign-in opens),
ADR-116 (the opt-in shape and the second factor this complements),
ADR-131 (the token-issuing proxy list),
ADR-134 (the adapter-package shape),
ADR-140 (the service accounts this refuses).