8000 Reject a different brokered user on forced re-authentication before c… by sguilhen · Pull Request #54462 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Reject a different brokered user on forced re-authentication before c… - #54462

Merged
pedroigor merged 1 commit into
keycloak:mainfrom
sguilhen:54344-reject-different-user-broker
Nov 6, 2026
Merged

pedroigor merged 1 commit into
keycloak:mainfrom
sguilhen:54344-reject-different-user-broker

Conversation

@sguilhen
Copy link
Copy Markdown
Contributor

…reating it

Closes #54344

Copilot AI balanced review requested due to automatic review settings October 29, 2026 16:28
@sguilhen
sguilhen requested a review from a team as a code owner October 29, 2026 16:28
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.

🟡 Changes recommended

The new guard rejects unlinked identities before first-broker-login can resolve them to the existing session user, breaking previously successful login and auto-link flows.

1 open issue
What changed in this PR

This PR addresses #54344 by rejecting a different brokered user during forced re-authentication before first-broker-login can create an account without an identity-provider link.

Changes:

  • Adds an early check against the user holding the existing session.
  • Adds regression tests for rejection, event reporting, subsequent login, same-user re-authentication, and explicit account linking.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​broker/​KcOidcBrokerForcedReauthenticationDifferentUserTest.java Adds integration coverage for forced re-authentication and account-linking behavior.
services/​src/​main/​java/​org/​keycloak/​services/​resources/​IdentityBrokerService.java Checks the existing session user before starting first-broker-login.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 30, 2026 17:16
@sguilhen
sguilhen force-pushed the 54344-reject-different-user-broker branch from e72be3f to a943682 Compare October 30, 2026 17: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.

🟢 Approval recommended

No active review issues were identified for the change intended to prevent orphaned accounts during forced broker re-authentication.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@vramik vramik 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.

LGTM, thank you @sguilhen

…reating it

Closes keycloak#54344

Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
@pedroigor
pedroigor force-pushed the 54344-reject-different-user-broker branch from a943682 to bab7289 Compare November 6, 2026 13:18
Copilot AI balanced review requested due to automatic review settings November 6, 2026 13:19
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.

🟢 Approval recommended

No active review issues remain for the brokered re-authentication changes.

No open issues 🎉

Review effort: Balanced

@pedroigor
pedroigor merged commit 6ea53a2 into keycloak:main Nov 6, 2026
96 checks passed
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.

IdP first-broker-login creates user without IdP link when prompt=login re-authenticates as a different user

4 participants

0