Update Blazor Identity scaffolder to align with the .NET 11 Blazor Web App template
- Dominant language
- C#
- Stars
- 818
- Forks
- 260
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 10
Description
## Summary
Update the Blazor Identity scaffolder's .NET 11 templates and code modification logic to align with the ASP.NET Core Blazor Web App project template in `dotnet/aspnetcore`.
The current scaffolder includes the initial .NET 11 passkey surface, but it has drifted from the implementation in:
`src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1`
## Required updates
- [ ] Update passkey antiforgery handling to match the project template:
- Use `[RequireAntiforgeryToken]` and `IAntiforgeryValidationFeature` for the passkey and personal-data endpoints.
- Remove manually generated antiforgery headers from `PasskeySubmit.razor` and `PasskeySubmit.razor.js`.
- Add `formnovalidate` to the passkey submit button.
- Remove now-redundant explicit `` instances.
- [ ] Replace the custom `Identity.StatusMessage` cookie flow with the .NET 11 Razor components TempData support using `[SupplyParameterFromTempData]`.
- Simplify `IdentityRedirectManager` and `StatusMessage` accordingly.
- Update all affected account and account-management components.
- Update `InvalidUser.razor` to generate its message directly.
- [ ] Add and scaffold `PasskeyAuthenticators.cs`.
- Display friendly authenticator names and passkey creation dates.
- Infer a default passkey name for known authenticators.
- [ ] Update form behavior and metadata:
- Use `EditContext.ValidateAsync()` in `Login.razor`.
- Use `` and matching `[Display]` attributes consistently across Identity forms.
- [ ] Update `IdentityNoOpEmailSender` wording so recipients are told they can ignore confirmation and password-reset messages they did not request.
- [ ] Align authentication and render-mode wiring with the project template where applicable:
- Register the revalidating authentication-state provider only for Interactive Server.
- Add authorization for non-server rendering.
- Configure authentication-state serialization/deserialization for WebAssembly and Auto rendering.
- Ensure globally interactive apps use `AcceptsInteractiveRouting()` so Identity components render using static SSR.
- [ ] Regenerate the checked-in `.cs`/`.Interfaces.cs` files produced from the updated `.tt` templates.
- [ ] Expand the .NET 11 integration tests beyond file existence/build checks to verify the generated passkey, TempData, antiforgery, form-validation, and render-mode wiring.
## Relevant ASP.NET Core changes
- dotnet/aspnetcore#67589 — Fix Blazor passkey registration under CSRF protection
- dotnet/aspnetcore#67258 — Fix passkey login broken by SSR client-side validation
- dotnet/aspnetcore#67662 — Make `EditContext.Validate` obsolete and update the project template
- dotnet/aspnetcore#66747 — Improve default Identity email wording
## Scaffolder areas
- `src/dotnet-scaffolding/dotnet-scaffold/AspNet/Templates/net11.0/BlazorIdentity`
- `src/dotnet-scaffolding/dotnet-scaffold/AspNet/Templates/net11.0/Files/PasskeySubmit.razor.js`
- `src/dotnet-scaffolding/dotnet-scaffold/AspNet/Templates/net11.0/CodeModificationConfigs/blazorIdentityChanges.json`
- `src/dotnet-scaffolding/dotnet-scaffold/AspNet/Helpers/BlazorIdentityHelper.cs`
- `test/dotnet-scaffolding/dotnet-scaffold.Tests/AspNet/Integration/Identity/BlazorIdentityNet11IntegrationTests.cs`
Contributor guide
Research direction
Compare the .NET 11 Blazor Web App template with the files under src/dotnet-scaffolding/dotnet-scaffold/AspNet/Templates/net11.0/BlazorIdentity and the listed code-modification files. Start with BlazorIdentityHelper.cs and BlazorIdentityNet11IntegrationTests.cs, then run the integration tests. Done means the templates, generated files, wiring, and expanded behavior checks align with the referenced template changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100