Repository navigation
Honor all sign-in confirmation requirements after registration - #68631
Conversation
Use CanSignInAsync in Identity UI and Blazor template registration paths so confirmed email and phone requirements are not bypassed. Co-authored-by: Copilot <[email protected]> Copilot-Session: 90f89215-6960-46df-b090-8514d1929d57
There was a problem hiding this comment.
Pull request overview
Updates the Identity UI and Blazor “Individual” templates so registration (password + external) no longer auto-signs-in users when any configured sign-in confirmation requirement would block sign-in. This aligns post-registration behavior with the effective sign-in policy by checking CanSignInAsync rather than only RequireConfirmedAccount.
Changes:
- Replace
RequireConfirmedAccountchecks withCanSignInAsyncin registration flows (Identity UI V4/V5 + Blazor template pages). - Add/adjust template and functional tests to cover “RequireConfirmedEmail” scenarios and updated registration expectations.
- Update Blazor template test to validate the template works when
RequireConfirmedEmail(instead ofRequireConfirmedAccount) is enabled.
Show a summary per file
| File | Description |
|---|---|
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/Register.razor | Use SignInManager.CanSignInAsync to decide whether to redirect to registration confirmation vs sign-in. |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Pages/ExternalLogin.razor | Apply the same CanSignInAsync gating for external registration. |
| src/ProjectTemplates/test/Templates.Blazor.Tests/BlazorWebTemplateTest.cs | Add template test verifying the flow when RequireConfirmedEmail is enabled. |
| src/Identity/UI/src/Areas/Identity/Pages/V5/Account/Register.cshtml.cs | Honor all sign-in confirmation requirements via CanSignInAsync after password registration. |
| src/Identity/UI/src/Areas/Identity/Pages/V5/Account/ExternalLogin.cshtml.cs | Honor all sign-in confirmation requirements via CanSignInAsync after external registration. |
| src/Identity/UI/src/Areas/Identity/Pages/V4/Account/Register.cshtml.cs | Same behavior update for V4 Identity UI. |
| src/Identity/UI/src/Areas/Identity/Pages/V4/Account/ExternalLogin.cshtml.cs | Same behavior update for V4 Identity UI. |
| src/Identity/test/Identity.FunctionalTests/RegistrationTests.cs | Add functional coverage for “RequireConfirmedEmail” registration (password + external). |
| src/Identity/test/Identity.FunctionalTests/LoginTests.cs | Update login tests to register using the confirmation-required path. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Lite
halter73
left a comment
There was a problem hiding this comment.
Should we update IdentitySample.DefaultUI's Register page too? It still has the RequireConfirmedAccount check we're replacing everywhere else.
Use CanSignInAsync in IdentitySample.DefaultUI and rename rejected-login test helpers to describe policy failures accurately. Co-authored-by: Copilot <[email protected]> Copilot-Session: 90f89215-6960-46df-b090-8514d1929d57
|
/backport to release/11.0-rc1 |
|
Started backporting to |
… (#68655) Co-authored-by: Brennan <[email protected]>
* [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 <[email protected]> Co-authored-by: Copilot App <[email protected]> Copilot-Session: 82e97f5a-a052-4dbe-9cf1-b62f45cf7ee2 * Honor all sign-in confirmation requirements after registration (#68631) (#68655) Co-authored-by: Brennan <[email protected]> * Preserve BadHttpRequestException status codes (#68632) (#68649) * Preserve BadHttpRequestException status codes * Preserve exception handler 404 safeguard --------- Co-authored-by: Stephen Halter <[email protected]> Co-authored-by: Copilot App <[email protected]> * SignInManager: return SignInResult.Failed for expired passkey session challenge (#67539) (#68654) Co-authored-by: Grant Totinov <[email protected]> * 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 <[email protected]> Copilot-Session: cb987098-3301-465b-9a3d-2e63aabf43bd * test both antiforgery & csrf --------- Co-authored-by: Copilot App <[email protected]> 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 <[email protected]> * [release/11.0-rc1] Extract IsAuthenticated helper method (#68658) * Extract IsAuthenticated helper method Co-authored-by: Youssef1313 <[email protected]> * Reorder using Co-authored-by: Copilot Autofix powered by AI <[email protected]> Co-authored-by: Youssef1313 <[email protected]> * Use SecurityHelper for authentication revalidation Co-authored-by: Copilot <[email protected]> Co-authored-by: Youssef1313 <[email protected]> --------- Co-authored-by: Youssef1313 <[email protected]> Co-authored-by: Youssef1313 <[email protected]> Co-authored-by: Milos Kotlar <[email protected]> * Fix InitialItemIndex viewport underfill for small items in big container or on window resize (#67936) (#68689) Co-authored-by: Ilona Tomkowicz <[email protected]> * 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 <[email protected]> Co-authored-by: Copilot App <[email protected]> Co-authored-by: Brennan <[email protected]> Co-authored-by: Stephen Halter <[email protected]> Co-authored-by: Grant Totinov <[email protected]> Co-authored-by: Korolev Dmitry <[email protected]> Co-authored-by: Ilona Tomkowicz <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Youssef1313 <[email protected]> Co-authored-by: Youssef1313 <[email protected]> Co-authored-by: Milos Kotlar <[email protected]> Co-authored-by: William Godbe <[email protected]> Copilot-Session: 82e97f5a-a052-4dbe-9cf1-b62f45cf7ee2 Copilot-Session: cb987098-3301-465b-9a3d-2e63aabf43bd
Behavior change: Identity UI and Blazor templates now honor all configured sign-in confirmation requirements after password or external registration. Users requiring confirmed email or phone are redirected to registration confirmation instead of being signed in automatically.
If desired for your application, you can restore automatic sign-in by disabling the relevant requirement(s):
options.SignIn.RequireConfirmedEmail = false;options.SignIn.RequireConfirmedPhoneNumber = false;options.SignIn.RequireConfirmedAccount = false;There is no compatibility switch to keep confirmation required for later sign-ins while bypassing it during registration. That behavior requires scaffolding/customizing the registration pages and explicitly calling
SignInAsyncor changing the check back to_userManager.Options.SignIn.RequireConfirmedAccount.