-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix test LDAP connection with multiple ldap connection urls (#31267) #31289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix test LDAP connection with multiple ldap connection urls (#31267) #31289
Conversation
jonkoops
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some optional feedback
federation/ldap/src/main/java/org/keycloak/services/managers/LDAPServerCapabilitiesManager.java
Outdated
Show resolved
Hide resolved
federation/ldap/src/main/java/org/keycloak/services/managers/LDAPServerCapabilitiesManager.java
Outdated
Show resolved
Hide resolved
f0281a8 to
1343264
Compare
|
Thanks for the review @jonkoops! I added your suggestions! |
jonkoops
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @thomasdarimont would it be possible to write a test to cover this? Looks like we already have a UserFederationLdapConnectionTest test that might bbe extendable.
|
For some reason the existing tests in |
1343264 to
7e64f38
Compare
|
@jonkoops added additional test. The issue was that the problem only occurred when the testLDAPConnection was used in combination with a stored LDAP federation provider model. |
|
@rmartinc - could you please review as well? Thanks! |
rmartinc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor change, I think you just need to return false and not throw an exception following the same idea. And thanks for the PR!
federation/ldap/src/main/java/org/keycloak/services/managers/LDAPServerCapabilitiesManager.java
Outdated
Show resolved
Hide resolved
|
thanks for the review @rmartinc ! I adapted the code accordingly. |
…#31267) Previously, the given connection string was check with URI.create(..) which failed when multiple space separated LDAP URLs were given. Fixes keycloak#31267 Signed-off-by: Thomas Darimont <[email protected]>
Signed-off-by: Thomas Darimont <[email protected]>
867647f to
5045455
Compare
rmartinc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @thomasdarimont!
ahus1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving based on @rmartinc's review.
|
Maybe not the right place, but: there should be a minimal documentation on this. I was actually configuring multiple LDAP provider to implement failover. Only https://www.keycloak.org/docs/latest/server_admin/index.html#dealing-with-provider-failures makes clear that mulitple provider conf isn't going to failover, but doesn't say multiple URL for a provider is possible. |
|
Food for thoughts: This is how it's implemented in LDAP itself: That seems clever to me, is it how it works in KC when multiple URLs are provided? |
|
@nodje comments left here are likely to fall on deaf ears, I would recommend logging a new issue referencing this one. |
|
thx, will do |
Previously, the given connection string was check with URI.create(..) which failed when multiple space separated LDAP URLs were given.
Fixes #31267