Added code to override the default LDAP connect timeout to something

more reasonable to allow fail-over to other LDAP servers without holding
up the end-user for too long.
This commit is contained in:
Juan Carlos Luciani 2008-02-01 20:05:38 +00:00
parent efa08e3658
commit e441d9d5a9
4 changed files with 5 additions and 0 deletions

View File

@ -737,6 +737,7 @@ public final class CasaIdentityToken implements IdentityToken
{ {
// Open a directory context and use it to read the identity attributes. // Open a directory context and use it to read the identity attributes.
Hashtable env = new Hashtable(); Hashtable env = new Hashtable();
env.put("com.sun.jndi.ldap.connect.timeout", 15000); // Override default LDAP timeout
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.bandit.ia.IAInitialCtxFactory"); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.bandit.ia.IAInitialCtxFactory");
env.put(Realm.REALM_CONFIG_LOCATION, svcConfig.getSetting(SvcConfig.IdentityAbstractionConfigFile)); env.put(Realm.REALM_CONFIG_LOCATION, svcConfig.getSetting(SvcConfig.IdentityAbstractionConfigFile));
env.put(Realm.REALM_SELECTOR, sourceName); env.put(Realm.REALM_SELECTOR, sourceName);

View File

@ -208,6 +208,7 @@ public final class Krb5Authenticate implements AuthMechanism, Serializable
// Open a directory context and use it to identify the users // Open a directory context and use it to identify the users
// associated with the specified surname. // associated with the specified surname.
Hashtable env = new Hashtable(); Hashtable env = new Hashtable();
env.put("com.sun.jndi.ldap.connect.timeout", 15000); // Override default LDAP timeout
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.bandit.ia.IAInitialCtxFactory"); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.bandit.ia.IAInitialCtxFactory");
env.put(Realm.REALM_CONFIG_LOCATION, m_svcConfig.getSetting(SvcConfig.IdentityAbstractionConfigFile)); env.put(Realm.REALM_CONFIG_LOCATION, m_svcConfig.getSetting(SvcConfig.IdentityAbstractionConfigFile));
env.put(Realm.REALM_SELECTOR, authReqMsg.getRealm()); env.put(Realm.REALM_SELECTOR, authReqMsg.getRealm());

View File

@ -183,6 +183,7 @@ public final class PwdAuthenticate implements AuthMechanism, Serializable
// Open a directory context and use it to identify the users // Open a directory context and use it to identify the users
// associated with the specified surname. // associated with the specified surname.
Hashtable env = new Hashtable(); Hashtable env = new Hashtable();
env.put("com.sun.jndi.ldap.connect.timeout", 15000); // Override default LDAP timeout
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.bandit.ia.IAInitialCtxFactory"); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.bandit.ia.IAInitialCtxFactory");
env.put(Realm.REALM_CONFIG_LOCATION, m_svcConfig.getSetting(SvcConfig.IdentityAbstractionConfigFile)); env.put(Realm.REALM_CONFIG_LOCATION, m_svcConfig.getSetting(SvcConfig.IdentityAbstractionConfigFile));
env.put(Realm.REALM_SELECTOR, authReqMsg.getRealm()); env.put(Realm.REALM_SELECTOR, authReqMsg.getRealm());
@ -272,6 +273,7 @@ public final class PwdAuthenticate implements AuthMechanism, Serializable
try try
{ {
Hashtable env2 = new Hashtable(); Hashtable env2 = new Hashtable();
env2.put("com.sun.jndi.ldap.connect.timeout", 15000); // Override default LDAP timeout
env2.put(Context.INITIAL_CONTEXT_FACTORY, "org.bandit.ia.IAInitialCtxFactory"); env2.put(Context.INITIAL_CONTEXT_FACTORY, "org.bandit.ia.IAInitialCtxFactory");
env2.put(Realm.REALM_CONFIG_LOCATION, m_svcConfig.getSetting(SvcConfig.IdentityAbstractionConfigFile)); env2.put(Realm.REALM_CONFIG_LOCATION, m_svcConfig.getSetting(SvcConfig.IdentityAbstractionConfigFile));
env2.put(Realm.REALM_SELECTOR, authReqMsg.getRealm()); env2.put(Realm.REALM_SELECTOR, authReqMsg.getRealm());

View File

@ -215,6 +215,7 @@ public class RealmsInfo
// users attribute which theoretically should only be valid on an AD // users attribute which theoretically should only be valid on an AD
// server. // server.
Hashtable env = new Hashtable(); Hashtable env = new Hashtable();
env.put("com.sun.jndi.ldap.connect.timeout", 15000); // Override default LDAP timeout
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.bandit.ia.IAInitialCtxFactory"); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.bandit.ia.IAInitialCtxFactory");
env.put(Realm.REALM_CONFIG_LOCATION, realmConfigFilePath); env.put(Realm.REALM_CONFIG_LOCATION, realmConfigFilePath);
env.put(Realm.REALM_SELECTOR, realm.getId()); env.put(Realm.REALM_SELECTOR, realm.getId());