Skip to content

feat(web): make the 403 page Blazor and give 401 its own page instead of redirecting straight to sign-in #87

Open

Description

@mwg-bender

This was generated by AI during triage.

What to build

Follow-up to #51 / #86, from Woody's review. Two things he was unsure about:

  1. The 403 page is static HTML, not Blazor. wwwroot/403.html is served through a 403 responseOverrides rewrite. Every other page in the app is Blazor, and Woody wants them all to be.
  2. Expired-session handling. Today an API call that finds the session expired force-navigates straight to /.auth/login/aad?post_login_redirect_uri=<current page> (SessionExpiredHandler). Woody would rather the 401 redirect to its own page than go directly to sign-in.

Constraint to settle first (needs a design decision, and Woody reviews it)

The SWA route table requires the admin role for * and /api/*. That covers the Blazor shell itself (index.html, _framework/*). So a signed-in non-admin cannot load a Blazor page at all, and neither can a signed-out user, which is exactly why the 403 page had to be a static file. A Blazor 403 or 401 page therefore needs the app shell (and only the shell) reachable without admin, with every /api/* route still admin-only. That is an auth and staticwebapp.config.json change. I have not checked how far the route table can be narrowed or what responseOverrides can rewrite to; that is the first thing to establish.

Acceptance criteria

  • A decision recorded in this issue: how a Blazor page can be served to a non-admin or signed-out user without exposing any admin page or API data.
  • A signed-in non-admin sees a Blazor 403 page with a sign-out link; /api/* still answers 403 with no data.
  • A 401 lands on its own Blazor page (with a sign-in link carrying the return path) instead of going straight to sign-in, or a documented reason why that is not possible.
  • 403.html is removed if nothing needs it any more.
  • Verified on a running stack as admin, signed out and (where the SWA CLI allows) non-admin. Note: the SWA CLI emulator answers a non-admin with 401, not 403, so the 403 case can only be partly shown live.

Notes

Activity

  1. added
    enhancement
    on Oct 3, 2026
  2. added this to the 0.8.0 milestone on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions