I'm currently working on a small project with Active Directory and some LDAP stuff... I try to connect to the LDAP server and it always gives me the same error:
[LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1
As much as I know this means that the credentials are wrong, but I'm 100% sure that they're right! Could it be that I forgot a parameter?
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://libertycity.ch:389/dc=libertycity,dc=ch");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_CREDENTIALS, password);
env.put(Context.SECURITY_PRINCIPAL, "uid=" + username + ",ou=Users");
env.put("java.naming.ldap.attributes.binary", "objectSID");
DirContext ctx = new InitialDirContext(env);
I think my code looks right, or did I miss something? What could be the problem and how can I find that out?
The value, "data 52e", provided in the error implies the bind failed due to: Returns when username is valid but password/credential is invalid.
http://ldapwiki.com/wiki/Common%20Active%20Directory%20Bind%20Errors
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With