I try to use LDAP authentication.
public boolean login(String username, String password){
AndFilter filter = new AndFilter();
filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("uid", username));
return ldapTemplate.authenticate(DistinguishedName.EMPTY_PATH, filter.toString(), password);
}
Because I used ActiveDirectory server, I have this exception:
javax.naming.NamingException: [LDAP: error code 1 – 000020D6: SvcErr: DSID-03100754, problem 5012 (DIR_ERROR), data 0]; remaning name = ‘/’
In my opinion, this exception showed, because I use DistinguishedName.EMPTY_PATH.
How I can to fix this problem?
The actual error you have is the following:
This can be found by converting the error code you have (000020D6) into decimal and checking in winerror.h.
In my opinion you need to supply a base DN for the search you are performing. The one you have supplied (supposedly by default, when not specified) is /, which is not a valid DN. If you domain name is domain.example.com, a valid base DN will be DC=domain,DC=example,DC=com.