Skip to content

Pr/issue 3701#3951

Open
fhanik wants to merge 6 commits into
developfrom
pr/issue-3701
Open

Pr/issue 3701#3951
fhanik wants to merge 6 commits into
developfrom
pr/issue-3701

Conversation

@fhanik

@fhanik fhanik commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

PR for Issue #3701 - Still needs review before merge

concurrent-login-error-page

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Issue #3701 by changing UAA’s external OAuth callback handling so that a “stale state” (common with multiple concurrent login attempts in different tabs) can be surfaced as a user-friendly /oauth_error page rather than a cryptic “Invalid state parameter” failure.

Changes:

  • Detect “concurrent login attempt” on external OAuth callback state mismatches and redirect to /oauth_error with a dedicated session flag.
  • Render a new friendly concurrent-login message + “Start a new login” link on the external auth error page when that flag is present.
  • Add unit, view, and Selenium integration tests covering the concurrent-login scenario and the new error page behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
server/src/main/java/org/cloudfoundry/identity/uaa/provider/oauth/ExternalOAuthAuthenticationFilter.java Adds concurrent-login detection/redirect behavior when state mismatches.
server/src/main/java/org/cloudfoundry/identity/uaa/provider/oauth/ConcurrentLoginAttemptException.java Introduces a dedicated exception used to signal the concurrent-login scenario.
server/src/main/java/org/cloudfoundry/identity/uaa/home/HomeController.java Consumes oauth_concurrent_login from the session and exposes it to the view.
server/src/main/resources/templates/web/external_auth_error.html Displays a friendly concurrent-login message and restart link when oauth_concurrent_login is set.
server/src/test/java/org/cloudfoundry/identity/uaa/provider/oauth/ExternalOAuthAuthenticationFilterTest.java Extends filter unit tests to cover concurrent-login behavior; includes minor test refactors.
server/src/test/java/org/cloudfoundry/identity/uaa/provider/oauth/ExternalOAuthConcurrentLoginScenarioTest.java Adds scenario-style tests documenting/validating expected concurrent-login behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/login/HomeControllerViewTests.java Adds view tests asserting the concurrent-login message/link and session attribute consumption.
uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/pageObjects/OAuthErrorPage.java Adds a Selenium page object for /oauth_error assertions and interaction.
uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/feature/ConcurrentExternalLoginIT.java Adds an integration test reproducing the multi-tab stale-state flow and asserting the friendly error page.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

@fhanik fhanik marked this pull request as draft June 19, 2026 14:00
strehle
strehle previously approved these changes Jun 19, 2026

@strehle strehle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if you want do more or if this is ready

@github-project-automation github-project-automation Bot moved this from Inbox to Pending Merge | Prioritized in Foundational Infrastructure Working Group Jun 19, 2026
@fhanik fhanik marked this pull request as ready for review June 19, 2026 14:42
@strehle strehle requested a review from Copilot June 19, 2026 14:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

…pt detected (#3701)

When a user initiates external OAuth login from two browser tabs, UAA stores
only the most-recent state in the HTTP session (overwriting the older one).
If the older tab's IDP callback arrives, the state check fails with a cryptic
error. This detects the specific case (session has a non-null state that differs
from the incoming state) and surfaces a human-readable "Another sign-in is
already in progress" message with a "Start a new login" link, while keeping
the existing CSRF protection intact for all other state-failure cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fhanik

fhanik commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@strehle ready for review and merge.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Comment thread server/src/main/resources/templates/web/external_auth_error.html
@strehle strehle requested a review from Copilot June 19, 2026 17:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

…ogin

Use getSession(false) in the callback state check so an expired/missing
session is rejected as an invalid login request instead of silently
creating a new stateless session, and handle HttpSessionRequiredException
in the filter alongside CsrfException. Add a security-monitoring log for
rejected callbacks and update the affected unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
@strehle

strehle commented Jun 19, 2026

Copy link
Copy Markdown
Member

I think you see the commit from agent, so you can rebase the commits...

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Comment thread server/src/main/resources/templates/web/external_auth_error.html Outdated
@strehle strehle requested a review from Copilot June 19, 2026 21:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

strehle
strehle previously approved these changes Jun 19, 2026
@strehle strehle requested a review from Copilot June 20, 2026 06:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@strehle strehle requested a review from Copilot June 21, 2026 08:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@strehle strehle requested a review from Copilot June 22, 2026 05:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Labels

None yet

Projects

Status: Pending Merge | Prioritized

Development

Successfully merging this pull request may close these issues.

Invalid state parameter when multiple login attempts are initiated with external IdP in different browser tabs

3 participants