Skip to content

feat(auth): OIDC RP-Initiated Logout#408

Merged
nadaverell merged 2 commits intomainfrom
feature/oidc-rp-initiated-logout
Apr 1, 2026
Merged

feat(auth): OIDC RP-Initiated Logout#408
nadaverell merged 2 commits intomainfrom
feature/oidc-rp-initiated-logout

Conversation

@nadaverell
Copy link
Copy Markdown
Contributor

@nadaverell nadaverell commented Apr 1, 2026

Summary

Fixes #381 — When a user clicks logout in OIDC mode, Radar now properly terminates the IdP session to prevent silent re-authentication.

Two complementary strategies based on IdP capabilities:

  1. RP-Initiated Logout (Okta, Keycloak, Azure AD): Radar discovers the end_session_endpoint from the OIDC discovery document at startup, stores the raw ID token in the session cookie, and returns the IdP's logout URL to the frontend for redirect.

  2. prompt=login fallback (Google, others without end_session_endpoint): On logout, Radar sets a short-lived cookie. The next auth request includes prompt=login, forcing the IdP to show a login screen instead of silently re-authenticating.

Both strategies clear the local session first. The approach is logged at startup so operators know which path is active.

New flag: --auth-oidc-post-logout-redirect-url (optional) — for RP-Initiated Logout, tells the IdP where to redirect after logout. Must be pre-registered with the IdP.

Changes

  • internal/auth/oidc.go — Discover end_session_endpoint, prompt=login fallback via force-login cookie, rewritten HandleLogout
  • pkg/auth/cookie.go — Store raw ID token in session cookie; add IDTokenFromCookie
  • web/src/components/UserMenu.tsx — Frontend follows redirectTo from logout response
  • cmd/explorer/main.go — New --auth-oidc-post-logout-redirect-url CLI flag
  • deploy/helm/radar/ — Helm chart support for the new flag
  • docs/authentication.md — Logout behavior docs, config reference, troubleshooting
  • 12 new tests covering all logout/login scenarios and cookie round-trips

When a user logs out in OIDC mode, Radar now redirects the browser to the
identity provider's end_session_endpoint (discovered from the OIDC discovery
document at startup) so the SSO session is also terminated. This prevents
the issue where users are silently re-authenticated immediately after logout.

- Store raw ID token in session cookie for use as id_token_hint
- Extract end_session_endpoint from OIDC provider discovery at startup
- Return redirect URL in logout JSON response for frontend to follow
- Graceful fallback to local-only logout when IdP doesn't support it
- New --auth-oidc-post-logout-redirect-url flag for post-logout redirect
- Backward compatible with existing sessions (falls back to client_id)
@nadaverell nadaverell requested a review from hisco as a code owner April 1, 2026 21:48
…ion_endpoint

For providers like Google that don't support RP-Initiated Logout, set a
short-lived cookie on logout so the next auth request includes prompt=login,
forcing the IdP to show a login screen instead of silently re-authenticating.
@nadaverell nadaverell merged commit 96b2dec into main Apr 1, 2026
6 checks passed
@nadaverell nadaverell deleted the feature/oidc-rp-initiated-logout branch April 1, 2026 22:20
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.

Logout redirects back to SSO and immediately re-authenticates

1 participant