5

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?

2
  • I trying to use ldapTemplate.authenticate(ctxt.getNameInNamespace(), filter.toString(), password); and other variations, but my problem not solved... Commented Aug 12, 2011 at 7:50
  • There is no uidin active directory bu only sAMAccountName. Commented Aug 12, 2011 at 11:29

1 Answer 1

14

The actual error you have is the following:

//
// MessageId: ERROR_DS_MISSING_SUPREF
//
// MessageText:
//
//  No superior reference has been configured for the 
//  directory service. The directory service is therefore 
//  unable to issue referrals to objects outside this forest.
//
#define ERROR_DS_MISSING_SUPREF          8406L

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.