Skip to content

SignInManager: return SignInResult.Failed for expired passkey session challenge - #67539

Merged
halter73 merged 17 commits into
dotnet:mainfrom
GrantTotinov:fix-passkey-signin-expired-session
Aug 19, 2026
Merged

SignInManager: return SignInResult.Failed for expired passkey session challenge#67539
halter73 merged 17 commits into
dotnet:mainfrom
GrantTotinov:fix-passkey-signin-expired-session

Conversation

@GrantTotinov

@GrantTotinov GrantTotinov commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

SignInManager: return SignInResult.Failed for expired passkey session challenge

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making.

Summary of the changes

Return SignInResult.Failed for expired or missing passkey session challenge.

Description

Passkey sign-in currently throws when the server-side session challenge is missing or expired, resulting in an unhandled exception instead of a controlled sign-in failure.

This change ensures that missing or invalid passkey session state results in SignInResult.Failed, aligning the behavior with other SignInManager authentication flows.

Changes

  • Handle missing or expired passkey session state in PasskeySignInCoreAsync
  • Prevent InvalidOperationException for recoverable authentication failures
  • Add unit test covering expired/missing session scenario

Testing

  • Added PasskeySignInReturnsFailedWhenSessionChallengeHasExpired
  • Verified existing passkey tests pass locally

Fixes #67410

Copilot AI review requested due to automatic review settings July 1, 2026 16:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates ASP.NET Core Identity’s SignInManager passkey sign-in flow so an expired/missing passkey session challenge results in a controlled SignInResult.Failed outcome instead of an unhandled exception, and adds a unit test for the scenario.

Changes:

  • Add an early check in PasskeySignInCoreAsync to return SignInResult.Failed when passkey session state is missing/invalid.
  • Add a new unit test covering the “expired/missing session challenge” passkey sign-in scenario.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/Identity/Core/src/SignInManager.cs Adds early failure handling for missing/invalid passkey session state during passkey sign-in.
src/Identity/test/Identity.Test/SignInManagerTest.cs Adds a new test to validate passkey sign-in returns Failed when the passkey session challenge is expired/missing.

Comment thread src/Identity/Core/src/SignInManager.cs
Comment thread src/Identity/test/Identity.Test/SignInManagerTest.cs Outdated
Comment thread src/Identity/test/Identity.Test/SignInManagerTest.cs
GrantTotinov and others added 3 commits July 2, 2026 01:43
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@GrantTotinov

Copy link
Copy Markdown
Contributor Author

@javiercn Sorry to tag you directly. I wasn't sure who to ping since there's no CODEOWNERS entry for this path. Could you take a look when you get a chance? Most checks are green (the two failing ones look unrelated - Windows local dev validation and an aggregate summary). Thanks!

@javiercn javiercn added area-identity Includes: Identity and providers community-contribution Indicates that the PR has been added by a community member labels Jul 30, 2026
@javiercn
javiercn temporarily deployed to copilot-pat-pool July 30, 2026 08:30 — with GitHub Actions Inactive
@javiercn
javiercn temporarily deployed to copilot-pat-pool July 30, 2026 08:31 — with GitHub Actions Inactive
@javiercn
javiercn temporarily deployed to copilot-pat-pool July 30, 2026 08:31 — with GitHub Actions Inactive
@javiercn
javiercn temporarily deployed to copilot-pat-pool July 30, 2026 08:32 — with GitHub Actions Inactive
@javiercn
javiercn temporarily deployed to copilot-pat-pool July 30, 2026 08:35 — with GitHub Actions Inactive
@javiercn
javiercn temporarily deployed to copilot-pat-pool July 30, 2026 08:36 — with GitHub Actions Inactive
@javiercn
javiercn temporarily deployed to copilot-pat-pool July 30, 2026 08:37 — with GitHub Actions Inactive

@halter73 halter73 left a comment

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.

Thanks for the PR!

Comment thread src/Identity/Core/src/SignInManager.cs Outdated
@halter73
halter73 enabled auto-merge (squash) August 19, 2026 20:08
@dotnet dotnet deleted a comment from github-actions Bot Aug 19, 2026
@dotnet dotnet deleted a comment from github-actions Bot Aug 19, 2026
@dotnet dotnet deleted a comment from github-actions Bot Aug 19, 2026
@dotnet dotnet deleted a comment from github-actions Bot Aug 19, 2026
Comment thread src/Identity/Core/src/SignInManager.cs Outdated
Comment thread src/Identity/Core/src/SignInManager.cs
Co-authored-by: Stephen Halter <shalter+msft@microsoft.com>
@halter73
halter73 merged commit 953cfb2 into dotnet:main Aug 19, 2026
25 checks passed
@halter73

Copy link
Copy Markdown
Member

/backport to release/11.0-rc1

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0-rc1 (link to workflow run)

@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Aug 20, 2026
wtgodbe pushed a commit that referenced this pull request Aug 21, 2026
… challenge (#67539) (#68654)

Co-authored-by: Grant Totinov <granttotinov604@gmail.com>
wtgodbe added a commit that referenced this pull request Aug 22, 2026
* [SignalR] Reject duplicate SignalR upload stream IDs (#68525) (#68638)

* Reject duplicate SignalR upload stream IDs



* Simplify upload stream ownership cleanup



* Avoid upload stream ownership allocations



* Simplify upload stream registration ownership



* Defer upload stream reader creation





* Dispose cancellation source after binding failure





* Reuse upload stream test helper





---------

Co-authored-by: Javier Calvarro Nelson <jacalvar@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 82e97f5a-a052-4dbe-9cf1-b62f45cf7ee2

* Honor all sign-in confirmation requirements after registration (#68631) (#68655)

Co-authored-by: Brennan <brecon@microsoft.com>

* Preserve BadHttpRequestException status codes (#68632) (#68649)

* Preserve BadHttpRequestException status codes



* Preserve exception handler 404 safeguard



---------

Co-authored-by: Stephen Halter <halter73@gmail.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* SignInManager: return SignInResult.Failed for expired passkey session challenge (#67539) (#68654)

Co-authored-by: Grant Totinov <granttotinov604@gmail.com>

* Don't apply the CSRF verdict to remote authentication callbacks (#68669)

* Don't apply the CSRF verdict to remote authentication callbacks

A remote provider's callback (OIDC response_mode=form_post, WS-Federation)
is a cross-site form POST by protocol design, so the auto-injected CSRF
protection records an invalid IAntiforgeryValidationFeature verdict for it.
The handler then throws while reading its own callback body, before any of
its events can run, so apps have no way to opt out.

Suppress the verdict while a remote handler owns the request, and restore it
if the handler declines so the rest of the pipeline still sees it.

Fixes #68666

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cb987098-3301-465b-9a3d-2e63aabf43bd

* test both antiforgery & csrf

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: cb987098-3301-465b-9a3d-2e63aabf43bd

* Use model display names in Blazor input parsing errors (#68667) (#68688)

* Use display attributes in input parsing errors

* Address test coverage feedback from review.

* Apply dedup cleanup from feedback.

Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com>

* [release/11.0-rc1] Extract IsAuthenticated helper method (#68658)

* Extract IsAuthenticated helper method

Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>

* Reorder using

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>

* Use SecurityHelper for authentication revalidation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>

---------

Co-authored-by: Youssef1313 <youssefvictor00@gmail.com>
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Co-authored-by: Milos Kotlar <kotlarmilos@gmail.com>

* Fix  InitialItemIndex viewport underfill for small items in big container or on window resize (#67936) (#68689)

Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com>

* fix nullable<union> for openapi gen (#68665)

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Javier Calvarro Nelson <jacalvar@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Brennan <brecon@microsoft.com>
Co-authored-by: Stephen Halter <halter73@gmail.com>
Co-authored-by: Grant Totinov <granttotinov604@gmail.com>
Co-authored-by: Korolev Dmitry <dmkorolev@microsoft.com>
Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Youssef1313 <youssefvictor00@gmail.com>
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Co-authored-by: Milos Kotlar <kotlarmilos@gmail.com>
Co-authored-by: William Godbe <wigodbe@microsoft.com>
Copilot-Session: 82e97f5a-a052-4dbe-9cf1-b62f45cf7ee2
Copilot-Session: cb987098-3301-465b-9a3d-2e63aabf43bd
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 community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SignInManager.PasskeySignInAsync throws InvalidOperationException when session challenge has expired instead of returning SignInResult.Failed

5 participants