Skip to content

For 4.2.10: By @thisisnsh: Restore the pre-login page after an idp_initiated OAuth login (backport #16961) (backport #16962)#16981

Closed
mergify[bot] wants to merge 2 commits into
v4.2.xfrom
mergify/bp/v4.2.x/pr-16962
Closed

For 4.2.10: By @thisisnsh: Restore the pre-login page after an idp_initiated OAuth login (backport #16961) (backport #16962)#16981
mergify[bot] wants to merge 2 commits into
v4.2.xfrom
mergify/bp/v4.2.x/pr-16962

Conversation

@mergify

@mergify mergify Bot commented Jul 20, 2026

Copy link
Copy Markdown

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


This is an automatic backport of pull request #16961 done by Mergify.


This is an automatic backport of pull request #16962 done by [Mergify](https://mergify.com).

thisisnsh and others added 2 commits July 20, 2026 16:05
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().

(cherry picked from commit 85d5d26)
(cherry picked from commit 5150706)
(cherry picked from commit 8d7333e)
(cherry picked from commit 391c71f)

# Conflicts:
#	deps/rabbitmq_management/priv/www/js/main.js
@mergify mergify Bot added the conflicts label Jul 20, 2026
@mergify

mergify Bot commented Jul 20, 2026

Copy link
Copy Markdown
Author

Cherry-pick of 391c71f has failed:

On branch mergify/bp/v4.2.x/pr-16962
Your branch is ahead of 'origin/v4.2.x' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 391c71fd27.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   deps/rabbitmq_management/priv/www/js/main.js

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify

mergify Bot commented Jul 20, 2026

Copy link
Copy Markdown
Author

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

  • Queue this pull request

@michaelklishin michaelklishin changed the title For 4.3.4: By @thisisnsh: Restore the pre-login page after an idp_initiated OAuth login (backport #16961) (backport #16962) For 4.2.10: By @thisisnsh: Restore the pre-login page after an idp_initiated OAuth login (backport #16961) (backport #16962) Jul 20, 2026
@michaelklishin michaelklishin modified the milestone: 4.2.10 Jul 20, 2026
@michaelklishin
michaelklishin deleted the mergify/bp/v4.2.x/pr-16962 branch July 20, 2026 20:46
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