1
Only thing I got so far was to connect in AD with the following code:
String enderecoLdap = paramLDAP.get("SERVER_URLS");
LOGGER.info(enderecoLdap);
if( ! enderecoLdap.toLowerCase().startsWith("ldap") ) enderecoLdap = "ldap://" + enderecoLdap;
String sNomAdmin = "user";
String sSenhaAdmin = "senha";
String sDesChaveNome = "name";
String sDesChaveEmail = "mail";
enderecoLdap = "ldap://oinco.secreto.br:389";
Hashtable<String, Object> ldapEnv = new Hashtable<String, Object>(11);
ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
/* Specify host and port to use for directory service */
ldapEnv.put(Context.PROVIDER_URL, enderecoLdap);
ldapEnv.put(Context.SECURITY_AUTHENTICATION, "simple");
ldapEnv.put(Context.SECURITY_PRINCIPAL, sNomAdmin);
ldapEnv.put(Context.SECURITY_CREDENTIALS, sSenhaAdmin);
ldapEnv.put(Context.SECURITY_PROTOCOL, "simple");
// Conecta no AD
ctx = new InitialLdapContext(ldapEnv, null);