I am trying to have my custom Java application use our Active Directory Server for authentication, but I cannot get it to work for some reason. Can anyone understand why this is so? Here is my method below:
private boolean authenticate(String serverName, String userId, String password) throws NamingException { DirContext ctx = null; Hashtable env = new Hashtable(11); boolean b = false; try { env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://servername.org:389"); env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, "uid="+ userId +",ou=All Users,dc=site,dc=org"); env.put(Context.SECURITY_CREDENTIALS, password); System.out.println("before context");
Result:
[12/14/11 16:27:47:746 CST] 0000001f SystemErr R javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 52e, vece
bschupbach
source share