8000 Restore LDAP connection URL failover for user authentication by tkyjovsk · Pull Request #55665 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Restore LDAP connection URL failover for user authentication - #55665

Merged
ahus1 merged 3 commits into
keycloak:mainfrom
tkyjovsk:55322
Dec 4, 2026
Merged

ahus1 merged 3 commits into
keycloak:mainfrom
tkyjovsk:55322

Conversation

@tkyjovsk
Copy link
Copy Markdown
Contributor

Closes #55322.

@tkyjovsk
tkyjovsk force-pushed the 55322 branch 3 times, most recently from 2656b1d to 4f2f448 Compare December 3, 2026 14:33
@tkyjovsk
tkyjovsk marked this pull request as ready for review December 3, 2026 15:34
@tkyjovsk
tkyjovsk requested a review from a team as a code owner December 3, 2026 15:34
Copilot AI balanced review requested due to automatic review settings December 3, 2026 15:34
@sguilhen
sguilhen commented Dec 3, 2026
Copy link
Copy Markdown
Contributor

@ahus1 @pedroigor could any of you re-run the failing tests for this one? Don't seem related to the PR.

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 are recorded for the LDAP authentication failover change.

No open issues 🎉

What changed in this PR

Restores LDAP user-authentication failover for multi-URL connections, addressing #55322 while preserving password-policy handling.

Changes:

  • Performs non-StartTLS binds during context creation so JNDI can try subsequent URLs.
  • Adds unit and integration coverage for LDAP/LDAPS failover, invalid credentials, recovery, and forced password changes.
  • Leaves StartTLS authentication behavior unchanged.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​federation/​ldap/​LDAPFailoverTest.java Adds end-to-end failover and password-policy tests.
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​federation/​ldap/​LDAPFailoverServer.java Provides two LDAP/LDAPS endpoints with shared directory state and simulated failures.
federation/​ldap/​src/​test/​java/​org/​keycloak/​storage/​ldap/​idm/​store/​ldap/​LDAPOperationManagerFailoverTest.java Adds focused bind-timeout, credential, and policy-control regression tests.
federation/​ldap/​src/​main/​java/​org/​keycloak/​storage/​ldap/​idm/​store/​ldap/​LDAPOperationManager.java Moves non-StartTLS user binds into initial context creation to enable failover.

Review effort: Balanced

pheiles and others added 3 commits December 4, 2026 13:39
Since the forced password change support for LDAP users, LDAPOperationManager.authenticate() created the LDAP context without credentials and bound later via reconnect(). JNDI only iterates over multiple space-separated connection URLs during context creation, so a primary server accepting TCP but failing or hanging on bind no longer failed over to the next URL. When StartTLS is not used, bind during context creation again, passing the password policy request control as connection control.

Closes keycloak#55322

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Peter Heiles <72147026+pheiles@users.noreply.github.com>
Signed-off-by: NedimPopovac <nedim.popovac@dedalus.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: NedimPopovac <115164896+NedimPopovac@users.noreply.github.com>
Cover bind timeouts, invalid credentials, recovery, and forced password changes, using an embedded LDAP server.

Signed-off-by: Tomas Kyjovsky <tkyjovsk@ibm.com>
Copilot AI balanced review requested due to automatic review settings December 4, 2026 12:40
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 are reported for the LDAP/LDAPS authentication failover change.

No open issues 🎉

Review effort: Balanced

@ahus1
ahus1 enabled auto-merge (squash) December 4, 2026 14:20
@ahus1
ahus1 merged commit 4329882 into keycloak:main Dec 4, 2026
95 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.

LDAP failover regression since 26.6.0

6 participants

0