Skip to content

Implement OIDC authentication with anonymous viewer mode - #202

Merged
sarroutbi merged 1 commit into
keylime-webtool:mainfrom
sarroutbi:oidc-authentication
Dec 2, 2026
Merged

sarroutbi merged 1 commit into
keylime-webtool:mainfrom
sarroutbi:oidc-authentication

Conversation

@sarroutbi

Copy link
Copy Markdown
Contributor

Replace the fake client-side demo login with the real OIDC authorization-code flow against the backend auth API (SR-001, SR-010, SR-011):

  • typed auth API module (login, code exchange, refresh, logout) through the shared envelope-unwrapping axios client
  • JWT decode helper mapping session-token claims to the dashboard user; the backend-issued role claim is authoritative (SR-002) and signatures are never verified client-side
  • auth store boots into the anonymous viewer role (SR-001), restores a persisted session, and attempts a single refresh when the stored token is expired
  • /auth/callback route exchanges the authorization code exactly once (StrictMode safe), renders a retryable error state, and returns the user to the page they came from
  • login page requests the opaque redirect_url, preserves the return location, reuses the app logo, offers a way back to the dashboard for anonymous browsing, and redirects authenticated users home
  • API client retries a 401 once after a token refresh, otherwise offers the login flow with returnTo; auth endpoints manage their own errors so the callback page cannot redirect-loop
  • top bar shows a sign-in link for anonymous users and a profile chip (avatar, friendly label, color-coded role, sign out) for authenticated ones; opaque subject ids stay out of the display and remain available in the tooltip
  • the client-side demo login is removed entirely: it installed a fake admin token that the backend correctly rejects, and the server-side demo-login endpoint is no longer called

Replace the fake client-side demo login with the real OIDC
authorization-code flow against the backend auth API (SR-001, SR-010,
SR-011):

- typed auth API module (login, code exchange, refresh, logout) through
  the shared envelope-unwrapping axios client
- JWT decode helper mapping session-token claims to the dashboard user;
  the backend-issued role claim is authoritative (SR-002) and signatures
  are never verified client-side
- auth store boots into the anonymous viewer role (SR-001), restores a
  persisted session, and attempts a single refresh when the stored token
  is expired
- /auth/callback route exchanges the authorization code exactly once
  (StrictMode safe), renders a retryable error state, and returns the
  user to the page they came from
- login page requests the opaque redirect_url, preserves the return
  location, reuses the app logo, offers a way back to the dashboard for
  anonymous browsing, and redirects authenticated users home
- API client retries a 401 once after a token refresh, otherwise offers
  the login flow with returnTo; auth endpoints manage their own errors
  so the callback page cannot redirect-loop
- top bar shows a sign-in link for anonymous users and a profile chip
  (avatar, friendly label, color-coded role, sign out) for authenticated
  ones; opaque subject ids stay out of the display and remain available
  in the tooltip
- the client-side demo login is removed entirely: it installed a fake
  admin token that the backend correctly rejects, and the server-side
  demo-login endpoint is no longer called

Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
@sarroutbi
sarroutbi force-pushed the oidc-authentication branch from 7101459 to 9a1a43d Compare December 2, 2026 14:20
@sarroutbi
sarroutbi merged commit 5ede5b2 into keylime-webtool:main Dec 2, 2026
6 checks passed
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