LDAP: How to authenticate user with sAMAccountName?
java, ldap, spring, spring-ldap
Solution
First off, the 525 error is bad DN. You can see a list of the LDAP errors AD returns at this link: AD LDAP Error codes
So you have a bad DN. What you want to do is search for samAccountName=username, get the DN from the returned value, and bind with that proper DN.
Problem
I am not able to authenticate when user passes `sAMAccountName` and `password`. If I do follwoing: ``` env.put(Context.SECURITY_PRINCIPAL, "CN="+username+",OU=Service Accounts,OU=TECH,DC=wawalab2,DC=ins"); env.put(Context.SECURITY_CREDENTIALS, password); ``` it throws exception: javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece ``` Note: I can use Spring LDAP framework too. ```