factory = ThreadLocalTLSSocketFactory.getHostnameVerifierFactory(cc.getSslConfig(), ldapUrl.getHostnames()); threadLocal = true;
hostnames[i] = entries[i].getHostname(); Assert.assertEquals(hostnames, url.getHostnames());
factory = ThreadLocalTLSSocketFactory.getHostnameVerifierFactory(cc.getSslConfig(), ldapUrl.getHostnames()); threadLocal = true;
/** * Returns a jndi connection factory using the properties found in the supplied connection config. If the supplied env * is null, the environment is retrieved from {@link #getDefaultEnvironment(ConnectionConfig, String)}. * * @param cc connection config * @param env context environment or null to use the default * * @return jndi connection factory */ protected JndiConnectionFactory getJndiConnectionFactory(final ConnectionConfig cc, final Map<String, Object> env) { SSLSocketFactory factory = config.getSslSocketFactory(); if (factory == null && (cc.getUseSSL() || cc.getLdapUrl().toLowerCase().contains("ldaps://"))) { // LDAPS hostname verification does not occur by default // set a default hostname verifier final LdapURL ldapUrl = new LdapURL(cc.getLdapUrl()); factory = ThreadLocalTLSSocketFactory.getHostnameVerifierFactory(cc.getSslConfig(), ldapUrl.getHostnames()); } return new JndiConnectionFactory( cc.getLdapUrl(), config, env != null ? env : getDefaultEnvironment(cc, factory != null ? factory.getClass().getName() : null)); }
contextInit.setHostnameVerifierConfig(new HostnameVerifierConfig(verifier, ldapUrl.getHostnames())); } else { contextInit.setHostnameVerifierConfig( new HostnameVerifierConfig(new DefaultHostnameVerifier(), ldapUrl.getHostnames())); new HostnameVerifyingTrustManager(new DefaultHostnameVerifier(), ldapUrl.getHostnames()));