Skip to content

By @thisisnsh: Restore the pre-login page after an idp_initiated OAuth login#16961

Merged
michaelklishin merged 2 commits into
mainfrom
rabbitmq-server-16957
Jul 17, 2026
Merged

By @thisisnsh: Restore the pre-login page after an idp_initiated OAuth login#16961
michaelklishin merged 2 commits into
mainfrom
rabbitmq-server-16957

Conversation

@michaelklishin

Copy link
Copy Markdown
Collaborator

This is #16957 by @thisisnsh with a small usability fix from me.

thisisnsh and others added 2 commits July 15, 2026 16:17
The management UI already remembers the page a user was on before an
OAuth login (the oauth-return-to pref) and restores it in the
sp_initiated flow via oauth_redirectToHome(). The idp_initiated flow
never restored it: start_app() always sent the user to '#/'.

idp_initiated has no dedicated OAuth callback page. The identity provider
POSTs the token to /login, the broker sets a cookie and redirects to '/',
and the app re-enters through the normal index.html -> start_app(). So
start_app() cannot tell a fresh login from a plain visit to '/': both
arrive with no hash. Reading oauth-return-to on every hashless load would
make every visit to '/' jump to the last saved page.

This change:

  - Captures oauth-return-to in oauth_initiateLogin (at the login click)
    rather than on page load, so a user who opens a URL and then navigates
    before logging in returns to the page they actually left from.
  - Sets a one-shot oauth-idp-pending marker for idp_initiated logins,
    which have no callback page to key the restore on.
  - In start_app, restores oauth-return-to only when oauth-idp-pending is
    set, then clears both. A plain visit to '/' has no pending login and
    goes home instead of jumping to the last saved page.
  - Adds Selenium regression tests (with-idp-initiated/oauth-return-to.js)
    covering: login from home stays on home; login from a deep-linked page
    returns to it; navigating before login returns to the last page; and a
    plain visit to '/' after login goes home (one-shot restore).

sp_initiated is unchanged; it keeps its own one-shot restore via
oauth_redirectToHome().
@mergify

mergify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@michaelklishin

Copy link
Copy Markdown
Collaborator Author

Note that we can only backport this after 4.3.3 ships.

@michaelklishin

Copy link
Copy Markdown
Collaborator Author

The OCI failure has to do with an expired token.

@michaelklishin
michaelklishin merged commit 547fe81 into main Jul 17, 2026
360 of 362 checks passed
@michaelklishin
michaelklishin deleted the rabbitmq-server-16957 branch July 17, 2026 02:28
@michaelklishin

Copy link
Copy Markdown
Collaborator Author

@thisisnsh congratulations on your first contribution! Well done 👍👍

@thisisnsh

Copy link
Copy Markdown
Contributor

@thisisnsh congratulations on your first contribution! Well done 👍👍

Thanks 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants