Skip to content

Support the WebAuthn signals API for passkeys - #68129

Merged
rolandVi merged 12 commits into
dotnet:rolandVi/passkey-workfrom
rolandVi:roland/passkey-signals
Aug 21, 2026
Merged

rolandVi merged 12 commits into
dotnet:rolandVi/passkey-workfrom
rolandVi:roland/passkey-signals

Conversation

@rolandVi

@rolandVi rolandVi commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

API proposal in #68165.

WebAuthn has three signal methods that let a site tell the browser's passkey provider what the server currently knows. Without them a deleted passkey keeps being offered at sign-in forever, a renamed user stays stale next to the passkey, and a credential the server has never heard of can never be cleared. This adds one method per signal.

Usage

if (SignInManager.SupportsPasskeySignalOptions)
{
    var acceptedJson = await SignInManager.MakeAllAcceptedCredentialsSignalOptionsAsync(user);
    var detailsJson = await SignInManager.MakeCurrentUserDetailsSignalOptionsAsync(user, userEntity);
}

var result = await SignInManager.PasskeySignInAsync(credentialJson);

if (!result.Succeeded)
{
    // null means do not signal
    var unknownJson = await SignInManager.MakeUnknownCredentialSignalOptionsAsync(credentialJson);
}
await PublicKeyCredential.signalAllAcceptedCredentials?.(JSON.parse(acceptedJson));
await PublicKeyCredential.signalCurrentUserDetails?.(JSON.parse(detailsJson));
await PublicKeyCredential.signalUnknownCredential?.(JSON.parse(unknownJson));

What changed

Each method returns JSON that is exactly one dictionary from the spec, so the browser passes it straight through. An earlier revision returned a single flat superset of the two signed-in payloads, which meant every app's JavaScript had to know which fields belonged to which call. That is spec knowledge duplicated outside the framework, and it breaks the moment a browser supports one signal and not the other.

Splitting also means each method asks for only what it needs. MakeAllAcceptedCredentialsSignalOptionsAsync takes just the user, since the credential list comes from the store. MakeCurrentUserDetailsSignalOptionsAsync takes the PasskeyUserEntity and never touches the passkey store at all.

The payloads are built by IPasskeyHandler<TUser>, so they resolve the RP ID the same way creation and assertion already do and a custom handler stays consistent with the passkeys it issued. SignInManager delegates and supplies the HttpContext, matching the other passkey methods.

This has to live in the framework because an app cannot easily assemble the payload: the user handle is not the user ID, it is the UTF-8 bytes base64url encoded through the internal BufferSource. Get it wrong and the call silently does nothing. signalUnknownCredential is worse, because it deletes permanently, so the handler only returns options on a clean miss from FindByPasskeyIdAsync and returns null whenever it cannot be certain.

IPasskeyHandler<TUser> shipped in .NET 10, so all three are default interface methods. The two signed-in ones throw, paired with SupportsPasskeySignalOptions. MakeUnknownCredentialSignalOptionsAsync returns null instead, since null already means do not signal and a flag would be a second way to say the same thing.

The Blazor template gets two components, AcceptedCredentialsSignal on the manage passkeys page and CurrentUserDetailsSignal on the profile page, plus the unknown credential signal on the login page. They are custom elements rather than JS interop because those pages are static SSR.

CurrentUserDetailsSignal sits on Account/Manage/Index and not on ConfirmEmailChange, which is where an earlier revision had it. That page is anonymous and finds its user from the UserId query string, so it would have rendered one account's passkey details for whoever held the confirmation link. The signal is idempotent, so deferring it to the next authenticated page view loses nothing.

Testing

17 handler tests and 7 on SignInManager, covering each payload's exact field set, the configured ServerDomain, the ID mismatch, and every null path on the unknown credential side.

End to end with the CDP virtual authenticator: the signalled credential list has to match what the authenticator actually holds and empty out after a delete, and the unknown credential signal has to complete before conditional autofill starts. That last one holds the signal promise pending, asserts autofill has not begun, then resolves it, so the ordering is pinned as a real dependency rather than a timing coincidence.

Resolves #68617.
Resolves #68128.

@rolandVi
rolandVi requested a review from a team as a code owner July 31, 2026 10:16
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jul 31, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @rolandVi. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@rokonec rokonec added area-identity Includes: Identity and providers and removed community-contribution Indicates that the PR has been added by a community member labels Jul 31, 2026
Comment thread src/Identity/Core/src/SignInManager.cs Resolved
@@ -1 +1,2 @@
#nullable enable
virtual Microsoft.AspNetCore.Identity.SignInManager<TUser>.MakePasskeySignalOptionsAsync(TUser! user, Microsoft.AspNetCore.Identity.PasskeyUserEntity! userEntity) -> System.Threading.Tasks.Task<string!>!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you open an API proposal following the API review process? #67299 doesn't have a proposed API in it.

Things I'd want the proposal to settle: whether this belongs on IPasskeyHandler<TUser> rather than SignInManager, whether the returned JSON should be a superset of both signal payloads or something directly passable to each JS call, and whether MakePasskeySignalOptionsAsync is the right name once signalUnknownCredential (#68128) shows up, since that one takes a different payload and gets called before sign-in.

@rolandVi rolandVi Aug 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #68165. It covers the mentioned talking points. I will align the design with @rokonec, as he will champion it through API review.

Comment thread src/Identity/Core/src/SignInManager.cs Resolved
Comment thread src/Identity/Core/src/SignInManager.cs Resolved
Comment thread src/Identity/Core/src/SignInManager.cs Resolved
@rolandVi
rolandVi requested a review from halter73 August 4, 2026 08:42
@rolandVi
rolandVi force-pushed the roland/passkey-signals branch from 22e92f2 to 0f8b457 Compare August 4, 2026 11:08
@rolandVi
rolandVi requested review from rokonec and removed request for halter73 August 4, 2026 15:49
@rolandVi

rolandVi commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
4 pipeline(s) were filtered out due to trigger conditions.

@rolandVi
rolandVi requested a balanced review from Copilot August 12, 2026 07:47
@rolandVi rolandVi changed the title Add WebAuthn Signal API support for passkeys Support signalAllAcceptedCredentials and signalCurrentUserDetails for passkeys Aug 18, 2026
Comment thread src/Identity/Core/src/PasskeyHandler.cs Resolved
@rolandVi rolandVi changed the title Support signalAllAcceptedCredentials and signalCurrentUserDetails for passkeys Support the WebAuthn signals API for passkeys Aug 19, 2026
@rolandVi
rolandVi requested a review from rokonec August 19, 2026 09:34
Comment thread src/Identity/Core/src/PasskeyHandler.cs Resolved
Comment thread src/Identity/Core/src/SignInManager.cs Resolved
Comment thread src/Identity/Core/src/SignInManager.cs Resolved
Comment thread src/Identity/Core/src/PasskeyHandler.cs Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-identity Includes: Identity and providers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants