Skip to content

fix(auth): resolve OIDC logout URL before clearing auth state - #191

Merged
cxymds merged 1 commit into
rustfs:mainfrom
PKizzle:fix/oidc-federated-logout-redirect
Aug 1, 2026
Merged

fix(auth): resolve OIDC logout URL before clearing auth state#191
cxymds merged 1 commit into
rustfs:mainfrom
PKizzle:fix/oidc-federated-logout-redirect

Conversation

@PKizzle

@PKizzle PKizzle commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

logoutWithOidcRedirect() called logout() before awaiting the config load, then set window.location.href to the RP-logout endpoint. Clearing auth state flips isAuthenticated to false, so during the await import() / loadConfig() gap DashboardAuthGuard fires router.replace("/auth/login/?unauthorized=true"). That redirect preempts the not-yet-assigned window.location.href, so the browser never reaches /rustfs/admin/v3/oidc/logout, the one-time logout token is never consumed, and the IdP session is left active.

This resolves the logout URL first and only then clears state and navigates, in the same synchronous step, so nothing can await between the state change and the redirect. Behaviour is otherwise unchanged: local state is still always cleared, and the no-session / error paths still return false.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • Unit tests added/updated
  • Manual testing completed

Added tests/lib/oidc-logout-source.test.js to lock the ordering (destination built before logout(); state not cleared ahead of the config await). Reproduced the original race and verified the fix against Authentik as the IdP: logout now reaches /rustfs/admin/v3/oidc/logout, which redirects to the provider end_session_endpoint and terminates the session.

pnpm test:run

Checklist

  • Code follows the project's style guidelines
  • Self-review completed
  • TypeScript types are properly defined
  • All commit messages are in English (Conventional Commits)
  • All existing tests pass
  • No new dependencies added, or they are justified

Related Issues

Closes #190

@PKizzle
PKizzle force-pushed the fix/oidc-federated-logout-redirect branch from de8ec14 to 0e45c2f Compare July 31, 2026 20:42
@cxymds
cxymds merged commit 5b8c03d into rustfs:main Aug 1, 2026
10 checks passed
@PKizzle
PKizzle deleted the fix/oidc-federated-logout-redirect branch August 1, 2026 07:23
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.

[BUG] OIDC RP-initiated logout never reaches the backend

2 participants