Currently, I'm using user and password as the connection credentials to ldap (in order to search on this AD).
My code looks like:
env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, ...);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, ...);
env.put(Context.SECURITY_CREDENTIALS, ...);
env.put("com.sun.jndi.ldap.connect.timeout", ...);
try {
ctx = new InitialLdapContext(env, null);
}
catch (NamingException e) {
System.out.println("error")
}
I want to change this code, so it will not use user+password as the credentials against the LDAP. I want it to authenticate using NTLM.
How can I do it? Can you provide an example?