public DirContextAuthenticationStrategy getAuthenticationStrategy() throws ClassNotFoundException, NoSuchAlgorithmException, IllegalAccessException, InstantiationException, KeyManagementException { if (!hasText(tlsConfig)) { tlsConfig = NONE; } AbstractTlsDirContextAuthenticationStrategy tlsStrategy; switch (tlsConfig) { case NONE: return new SimpleDirContextAuthenticationStrategy(); case SIMPLE: tlsStrategy = new DefaultTlsDirContextAuthenticationStrategy(); break; case EXTERNAL: tlsStrategy = new ExternalTlsDirContextAuthenticationStrategy(); break; default: throw new IllegalArgumentException(tlsConfig); } tlsStrategy.setHostnameVerifier(new AllowAllHostnameVerifier()); tlsStrategy.setSslSocketFactory(getSSLSocketFactory()); return tlsStrategy; } }