This fix allows the LDAP connection pool parameters - maxsize, prefsize, initsize - to be configured using JVM arguments.

Removed the check on connectionPoolingMaxSize, connectionPoolingInitSize and connectionPoolingPrefSize

Closes #30677

Signed-off-by: Rishabh Singh <rishabhsvats@gmail.com>

This fix allows all the LDAP connection pool parameters to be configured using JVM arguments.

Removed all the ldap connection pool parameters

Signed-off-by: Rishabh Singh <rishabhsvats@gmail.com>
This commit is contained in:
Rishabh Singh 2024-06-24 13:03:14 +05:30 committed by Pedro Igor
parent 5ff3488c80
commit 3a156b1a8b

View file

@ -54,7 +54,7 @@ public class LDAPIdentityStoreRegistry {
ldapStores.put(ldapModel.getId(), ldapConfig);
}
return createLdapIdentityStore(session, ldapConfig);
return new LDAPIdentityStore(session, ldapConfig);
}
// Don't log LDAP password
@ -68,30 +68,4 @@ public class LDAPIdentityStoreRegistry {
ldapModel.getName(), c.getName(), c.getProviderId(), c.getConfig().toString()));
}
}
/**
* Create LDAPIdentityStore to be cached in the local registry
*/
public static LDAPIdentityStore createLdapIdentityStore(KeycloakSession session, LDAPConfig cfg) {
checkSystemProperty("com.sun.jndi.ldap.connect.pool.authentication", cfg.getConnectionPoolingAuthentication(), "none simple");
checkSystemProperty("com.sun.jndi.ldap.connect.pool.initsize", cfg.getConnectionPoolingInitSize(), "1");
checkSystemProperty("com.sun.jndi.ldap.connect.pool.maxsize", cfg.getConnectionPoolingMaxSize(), "1000");
checkSystemProperty("com.sun.jndi.ldap.connect.pool.prefsize", cfg.getConnectionPoolingPrefSize(), "5");
checkSystemProperty("com.sun.jndi.ldap.connect.pool.timeout", cfg.getConnectionPoolingTimeout(), "300000");
checkSystemProperty("com.sun.jndi.ldap.connect.pool.protocol", cfg.getConnectionPoolingProtocol(), "plain ssl");
checkSystemProperty("com.sun.jndi.ldap.connect.pool.debug", cfg.getConnectionPoolingDebug(), "off");
return new LDAPIdentityStore(session, cfg);
}
private static void checkSystemProperty(String name, String cfgValue, String defaultValue) {
String value = System.getProperty(name);
if(cfgValue != null) {
value = cfgValue;
}
if(value == null) {
value = defaultValue;
}
System.setProperty(name, value);
}
}