Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out the right ldap parameters

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?

like image 812
muffin Avatar asked May 28 '13 09:05

muffin


1 Answers

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

like image 166
jwilleke Avatar answered Sep 19 '22 15:09

jwilleke