Skip to content
Permalink
Browse files
Merge pull request #62 from fbelzunc/JENKINS-36041-v4
[FIXED JENKINS-36041 JENKINS-25269] Enable com.sun.jndi.ldap.connect.timeout
  • Loading branch information
fbelzunc committed Mar 3, 2017
2 parents 95effde + 7b68679 commit f80f9555dbe17d61bd4e310e996cd95ee90fad1a
Showing 2 changed files with 5 additions and 5 deletions.
@@ -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;

@@ -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");
}
}

@@ -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);

0 comments on commit f80f955

Please sign in to comment.