From 1b373942760a470728965890fc9375f887db21cf Mon Sep 17 00:00:00 2001 From: rmartinc Date: Tue, 27 Nov 2018 15:32:10 +0100 Subject: [PATCH] KEYCLOAK-7242: LDAPS not working with truststore SPI and connection timeout --- .../main/java/org/keycloak/truststore/SSLSocketFactory.java | 6 ++++++ .../testsuite/admin/UserFederationLdapConnectionTest.java | 3 +++ 2 files changed, 9 insertions(+) diff --git a/services/src/main/java/org/keycloak/truststore/SSLSocketFactory.java b/services/src/main/java/org/keycloak/truststore/SSLSocketFactory.java index f7b5a1d217..90267bfaea 100755 --- a/services/src/main/java/org/keycloak/truststore/SSLSocketFactory.java +++ b/services/src/main/java/org/keycloak/truststore/SSLSocketFactory.java @@ -101,4 +101,10 @@ public class SSLSocketFactory extends javax.net.ssl.SSLSocketFactory { public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException { return sslsf.createSocket(address, port, localAddress, localPort); } + + @Override + public Socket createSocket() throws IOException { + return sslsf.createSocket(); + } + } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/UserFederationLdapConnectionTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/UserFederationLdapConnectionTest.java index 6ee926d653..03a1809d70 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/UserFederationLdapConnectionTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/UserFederationLdapConnectionTest.java @@ -71,6 +71,9 @@ public class UserFederationLdapConnectionTest extends AbstractAdminTest { response = realm.testLDAPConnection(LDAPConnectionTestManager.TEST_AUTHENTICATION, "ldaps://localhost:10636", "uid=admin,ou=system", "secret", "true", null); assertStatus(response, 204); + + response = realm.testLDAPConnection(LDAPConnectionTestManager.TEST_AUTHENTICATION, "ldaps://localhost:10636", "uid=admin,ou=system", "secret", "true", "10000"); + assertStatus(response, 204); } private void assertStatus(Response response, int status) {