Skip to content

Commit

Permalink
[JENKINS-36041] Enable com.sun.jndi.ldap.connect.timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
fbelzunc committed Mar 3, 2017
1 parent 95effde commit 7b68679
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -506,7 +506,10 @@ public DirContext bind(String principalName, String password, List<SocketInfo> l
}

newProps.put("java.naming.ldap.attributes.binary","tokenGroups objectSid");
newProps.put("java.naming.ldap.factory.socket",TrustAllSocketFactory.class.getName());

if (FORCE_LDAPS) {
newProps.put("java.naming.ldap.factory.socket", TrustAllSocketFactory.class.getName());
}
newProps.putAll(props);
NamingException namingException = null;

Expand Down Expand Up @@ -584,10 +587,8 @@ private LdapContext bind(String principalName, String password, SocketInfo serve
LOGGER.fine("Connection upgraded to TLS");
} catch (NamingException e) {
LOGGER.log(Level.FINE, "Failed to start TLS. Authentication will be done via plain-text LDAP", e);
context.removeFromEnvironment("java.naming.ldap.factory.socket");
} catch (IOException e) {
LOGGER.log(Level.FINE, "Failed to start TLS. Authentication will be done via plain-text LDAP", e);
context.removeFromEnvironment("java.naming.ldap.factory.socket");
}
}

Expand Down
Expand Up @@ -187,8 +187,7 @@ public ActiveDirectoryUnixAuthenticationProvider(ActiveDirectorySecurityRealm re
);

Map<String, String> extraEnvVarsMap = ActiveDirectorySecurityRealm.EnvironmentProperty.toMap(realm.environmentProperties);
// TODO In JDK 8u65 I am facing JDK-8139721, JDK-8139942 which makes the plugin to break. Uncomment line once it is fixed.
//props.put(LDAP_CONNECT_TIMEOUT, System.getProperty(LDAP_CONNECT_TIMEOUT, DEFAULT_LDAP_CONNECTION_TIMEOUT));
props.put(LDAP_CONNECT_TIMEOUT, System.getProperty(LDAP_CONNECT_TIMEOUT, DEFAULT_LDAP_CONNECTION_TIMEOUT));
props.put(LDAP_READ_TIMEOUT, System.getProperty(LDAP_READ_TIMEOUT, DEFAULT_LDAP_READ_TIMEOUT));
// put all the user defined properties into our context environment replacing any mappings that already exist.
props.putAll(extraEnvVarsMap);
Expand Down

0 comments on commit 7b68679

Please sign in to comment.