Skip to content

chore: upgrade EqDemo.BlazorWasm.AdhocReporting to .NET 8.0#21

Open
devin-ai-integration[bot] wants to merge 6 commits intomasterfrom
upgrade/blazor-wasm-adhocreporting-to-net8
Open

chore: upgrade EqDemo.BlazorWasm.AdhocReporting to .NET 8.0#21
devin-ai-integration[bot] wants to merge 6 commits intomasterfrom
upgrade/blazor-wasm-adhocreporting-to-net8

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 7, 2026

Summary

Upgrades all three Blazor WASM AdHocReporting sub-projects (Server, Client, Shared) from .NET 6.0 to .NET 8.0.

Package updates:

  • TargetFrameworknet8.0 across all three projects
  • Microsoft.AspNetCore.* / EntityFrameworkCore.* packages → 8.0.11
  • Microsoft.Data.SqlClient 2.1.7 → 5.2.2, CodeGeneration.Design → 8.0.7, Extensions.Http → 8.0.1
  • Bumped Microsoft.IdentityModel.JsonWebTokens and System.IdentityModel.Tokens.Jwt to 6.35.0 and NuGet.Common/NuGet.Protocol to 6.11.0 to resolve transitive dependency conflicts

IdentityServer removal (breaking change in .NET 8):

  • Removed Microsoft.AspNetCore.ApiAuthorization.IdentityServer package reference
  • Deleted OidcConfigurationController.cs
  • Changed AppDbContext base class from ApiAuthorizationDbContextIdentityDbContext (removed OperationalStoreOptions dependency)
  • Replaced AddIdentityServer()/AddApiAuthorization()/AddIdentityServerJwt() in server Program.cs with standard Identity cookie authentication scheme defaults
  • Removed app.UseIdentityServer() from the middleware pipeline

Client-side auth migration (OIDC → cookie auth):

  • Removed AddApiAuthorization() and BaseAddressAuthorizationMessageHandler from Client Program.cs
  • Replaced with a simple HttpClient + custom ServerAuthenticationStateProvider that checks auth state via a new GET /api/user endpoint
  • Added UserController on the server to expose current user's authentication status and roles
  • Updated LoginDisplay.razor: all navigation (Manage, Register, Login, Logout) uses NavigationManager.NavigateTo(..., forceLoad: true) via @onclick handlers to bypass the Blazor WASM router and correctly reach server-side Identity Razor Pages
  • Removed obsolete SignOutSessionStateManager usage
  • Updated Authentication.razor to redirect to Identity pages with forceLoad: true instead of using RemoteAuthenticatorView; uses relative returnUrl (/) to avoid LocalRedirect exceptions
  • Updated RedirectToLogin.razor to redirect to Identity login with forceLoad: true; converts Navigation.Uri to a base-relative path for returnUrl
  • Removed IAccessTokenProviderAccessor injection and OIDC token acquisition from Reports.razor; now passes null to startAdhocReporting JS call (the JS in eq.blazor.js already handles null tokens gracefully, and cookie auth is used automatically by the browser)
  • Removed unused AuthenticationService.js script reference from index.html

Third-party packages (Korzh.EasyQuery, EasyData, Korzh.DbUtils) were left unchanged as they are netstandard2.0-compatible.

Review & Testing Checklist for Human

⚠️ The entire auth flow was rewritten. Only dotnet build was verified — no runtime testing was performed. The following items should be carefully validated:

  • Cookie delivery to ServerAuthenticationStateProvider: The client uses new HttpClient { BaseAddress = ... } to call GET /api/user. In Blazor WASM, browser fetch() 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.
  • Runtime auth flow end-to-end: Run the app and test: register → login → verify "Hello, {name}" appears → manage account → log out → verify redirect to login. Also test that unauthenticated users are redirected to the Identity login page.
  • EasyQuery ad-hoc reporting with null token: Reports.razor now calls startAdhocReporting(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.
  • Silent exception swallowing in ServerAuthenticationStateProvider: The catch (Exception) block silently treats all errors as "not authenticated." If the /api/user endpoint has a routing or serialization issue, users will silently appear unauthenticated with no diagnostic feedback.
  • Database schema impact: The switch from ApiAuthorizationDbContext to IdentityDbContext drops 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.
  • Unused package reference: Microsoft.AspNetCore.Components.WebAssembly.Authentication is still referenced in the Client csproj but is no longer imported or used anywhere in code. Consider removing it.

Recommended test plan:

  1. dotnet run from the Server directory
  2. Navigate to the app in a browser
  3. Click "Register" → verify full-page navigation to Identity register page, create a user, verify redirect back to app root (/)
  4. Click "Log out" → verify navigation to Identity logout page
  5. Click "Log in" → verify full-page navigation to Identity login page, log in, verify "Hello, {name}" appears
  6. Click "Manage" → verify full-page navigation to Identity account management page
  7. Navigate to /reports → verify the ad-hoc reporting page loads and queries work with authenticated user (no JS errors about missing token)
  8. Verify that unauthenticated users are redirected to login (via RedirectToLogin.razor) and that returnUrl correctly sends them back to the original page after login

Notes

  • The build compiles cleanly with 0 errors and 0 warnings.
  • Snyk CI checks (security/license) show 3 failures — these are non-required dependency vulnerability scans unrelated to the code changes in this PR.

Link to Devin session: https://app.devin.ai/sessions/463b83d6b0de424783afbe2b57f8a318
Requested by: @tobydrinkall


Open with Devin

- 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>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

…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>
devin-ai-integration[bot]

This comment was marked as resolved.

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>
devin-ai-integration[bot]

This comment was marked as resolved.

… 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>
devin-ai-integration[bot]

This comment was marked as resolved.

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>
devin-ai-integration[bot]

This comment was marked as resolved.

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant