@Override public Hashtable<Object, Object> getEnvironment() { Hashtable<Object, Object> table = super.getEnvironment(); if (!LDAPAuthenticationHandler.getLdapSSLVerifyCertificate()) { table.put("java.naming.ldap.factory.socket", TrustAllSSLSocketFactory.class.getName()); } return table; } }