chore: upgrade EqDemo.BlazorWasm.AdhocReporting to .NET 8.0#21
Open
devin-ai-integration[bot] wants to merge 6 commits intomasterfrom
Open
chore: upgrade EqDemo.BlazorWasm.AdhocReporting to .NET 8.0#21devin-ai-integration[bot] wants to merge 6 commits intomasterfrom
devin-ai-integration[bot] wants to merge 6 commits intomasterfrom
Conversation
- Update TargetFramework from net6.0 to net8.0 in all 3 sub-projects (Server, Client, Shared) - Update Microsoft.AspNetCore.* packages from 6.0.x to 8.0.11 - Update Microsoft.EntityFrameworkCore.* packages from 6.0.1 to 8.0.11 - Update Microsoft.Data.SqlClient from 2.1.7 to 5.2.2 - Update Microsoft.VisualStudio.Web.CodeGeneration.Design from 6.0.1 to 8.0.7 - Update Microsoft.Extensions.Http from 6.0.0 to 8.0.1 - Bump Microsoft.IdentityModel.JsonWebTokens and System.IdentityModel.Tokens.Jwt to 6.35.0 - Bump NuGet.Common and NuGet.Protocol to 6.11.0 - Remove Microsoft.AspNetCore.ApiAuthorization.IdentityServer (removed in .NET 8) - Replace IdentityServer auth with standard ASP.NET Core Identity cookie auth - Remove OidcConfigurationController (no longer needed without IdentityServer) - Update AppDbContext to inherit from IdentityDbContext instead of ApiAuthorizationDbContext Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…d Identity - Remove AddApiAuthorization() and BaseAddressAuthorizationMessageHandler from Client/Program.cs - Add custom ServerAuthenticationStateProvider that checks auth via /api/user endpoint - Add UserController on server side to expose current user auth state - Update LoginDisplay.razor to use server-side Identity UI endpoints instead of OIDC - Update Authentication.razor to redirect to Identity pages instead of using RemoteAuthenticatorView - Update RedirectToLogin.razor to use server-side Identity login page - Resolves runtime auth breakage from IdentityServer removal Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
Replace form POST with NavigationManager.NavigateTo(forceLoad: true) to navigate to the server-rendered logout page, which has its own anti-forgery token. Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
… router Replace <a href> links to server-side Identity pages with @OnClick handlers that use NavigationManager.NavigateTo(forceLoad: true), preventing the Blazor WASM router from intercepting them and showing 'Not found'. Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
LocalRedirect rejects absolute URLs. Use '/' as returnUrl in Authentication.razor and convert Navigation.Uri to a relative path in RedirectToLogin.razor. Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
…d AuthenticationService.js Reports.razor was still injecting IAccessTokenProviderAccessor which is no longer registered after removing AddApiAuthorization(). Pass null token to startAdhocReporting since cookie auth is used automatically by the browser. Also remove the unused AuthenticationService.js script reference from index.html. Co-Authored-By: Toby Drinkall <toby.drinkall@cognition.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades all three Blazor WASM AdHocReporting sub-projects (Server, Client, Shared) from .NET 6.0 to .NET 8.0.
Package updates:
TargetFramework→net8.0across all three projectsMicrosoft.IdentityModel.JsonWebTokensandSystem.IdentityModel.Tokens.Jwtto 6.35.0 andNuGet.Common/NuGet.Protocolto 6.11.0 to resolve transitive dependency conflictsIdentityServer removal (breaking change in .NET 8):
Microsoft.AspNetCore.ApiAuthorization.IdentityServerpackage referenceOidcConfigurationController.csAppDbContextbase class fromApiAuthorizationDbContext→IdentityDbContext(removedOperationalStoreOptionsdependency)AddIdentityServer()/AddApiAuthorization()/AddIdentityServerJwt()in serverProgram.cswith standard Identity cookie authentication scheme defaultsapp.UseIdentityServer()from the middleware pipelineClient-side auth migration (OIDC → cookie auth):
AddApiAuthorization()andBaseAddressAuthorizationMessageHandlerfrom ClientProgram.csHttpClient+ customServerAuthenticationStateProviderthat checks auth state via a newGET /api/userendpointUserControlleron the server to expose current user's authentication status and rolesLoginDisplay.razor: all navigation (Manage, Register, Login, Logout) usesNavigationManager.NavigateTo(..., forceLoad: true)via@onclickhandlers to bypass the Blazor WASM router and correctly reach server-side Identity Razor PagesSignOutSessionStateManagerusageAuthentication.razorto redirect to Identity pages withforceLoad: trueinstead of usingRemoteAuthenticatorView; uses relativereturnUrl(/) to avoidLocalRedirectexceptionsRedirectToLogin.razorto redirect to Identity login withforceLoad: true; convertsNavigation.Urito a base-relative path forreturnUrlIAccessTokenProviderAccessorinjection and OIDC token acquisition fromReports.razor; now passesnulltostartAdhocReportingJS call (the JS ineq.blazor.jsalready handles null tokens gracefully, and cookie auth is used automatically by the browser)AuthenticationService.jsscript reference fromindex.htmlThird-party packages (Korzh.EasyQuery, EasyData, Korzh.DbUtils) were left unchanged as they are netstandard2.0-compatible.
Review & Testing Checklist for Human
dotnet buildwas verified — no runtime testing was performed. The following items should be carefully validated:ServerAuthenticationStateProvider: The client usesnew HttpClient { BaseAddress = ... }to callGET /api/user. In Blazor WASM, browserfetch()should include same-origin cookies by default, but verify that the auth cookie is actually sent on this request. If it isn't, the user will always appear unauthenticated on the client side despite being logged in on the server. This is the highest-risk item.Reports.razornow callsstartAdhocReporting(null)instead of passing a JWT. The JS (eq.blazor.js) should skip the Bearer header when token is null and rely on cookie auth. Verify that the reports page loads and queries execute correctly for an authenticated user.ServerAuthenticationStateProvider: Thecatch (Exception)block silently treats all errors as "not authenticated." If the/api/userendpoint has a routing or serialization issue, users will silently appear unauthenticated with no diagnostic feedback.ApiAuthorizationDbContexttoIdentityDbContextdrops IdentityServer-specific tables (DeviceCodes, PersistedGrants, Keys). If the app uses an existing database with prior migrations, verify that EF migrations still work or that the demo DB seeds correctly from scratch.Microsoft.AspNetCore.Components.WebAssembly.Authenticationis still referenced in the Client csproj but is no longer imported or used anywhere in code. Consider removing it.Recommended test plan:
dotnet runfrom the Server directory/)/reports→ verify the ad-hoc reporting page loads and queries work with authenticated user (no JS errors about missing token)RedirectToLogin.razor) and thatreturnUrlcorrectly sends them back to the original page after loginNotes
Link to Devin session: https://app.devin.ai/sessions/463b83d6b0de424783afbe2b57f8a318
Requested by: @tobydrinkall