Skip to content

Commit

Permalink
Setting protocol when initializing the LDAP provider
Browse files Browse the repository at this point in the history
Closes keycloak#35758

Signed-off-by: Pedro Igor <[email protected]>
  • Loading branch information
pedroigor committed Dec 11, 2024
1 parent 7821356 commit 2645fb1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public class LDAPStorageProviderFactory implements UserStorageProviderFactory<LD

private static final Logger logger = Logger.getLogger(LDAPStorageProviderFactory.class);
public static final String PROVIDER_NAME = LDAPConstants.LDAP_PROVIDER;
private static final String LDAP_CONNECTION_POOL_PROTOCOL = "com.sun.jndi.ldap.connect.pool.protocol";

private LDAPIdentityStoreRegistry ldapStoreRegistry;

Expand Down Expand Up @@ -313,6 +314,10 @@ public void validateConfiguration(KeycloakSession session, RealmModel realm, Com

@Override
public void init(Config.Scope config) {
// set connection pooling for plain and tls protocols by default
if (System.getProperty(LDAP_CONNECTION_POOL_PROTOCOL) == null) {
System.setProperty(LDAP_CONNECTION_POOL_PROTOCOL, "plain ssl");
}
this.ldapStoreRegistry = new LDAPIdentityStoreRegistry();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,12 @@
public class KeycloakMain implements QuarkusApplication {

private static final String INFINISPAN_VIRTUAL_THREADS_PROP = "org.infinispan.threads.virtual";
private static final String LDAP_CONNECTION_POOL_PROTOCOL = "com.sun.jndi.ldap.connect.pool.protocol";

static {
// enable Infinispan and JGroups virtual threads by default
if (System.getProperty(INFINISPAN_VIRTUAL_THREADS_PROP) == null) {
System.setProperty(INFINISPAN_VIRTUAL_THREADS_PROP, "true");
}
// set connection pooling for plain and tls protocols by default
if (System.getProperty(LDAP_CONNECTION_POOL_PROTOCOL) == null) {
System.setProperty(LDAP_CONNECTION_POOL_PROTOCOL, "plain ssl");
}
}

public static void main(String[] args) {
Expand Down

0 comments on commit 2645fb1

Please sign in to comment.