0
votes

I am using Spring Security(basic authentication) + LDAP authentication which works well with embedded test ldif but not with my domain LDAP. However, I can use a LDAP browser/edit tool to search my account using the same filter(SamAccountName=napo)

@Override  
public void addServiceAuthenticationManager(AuthenticationManagerBuilder   authBuilder) throws Exception {
       authBuilder
            .ldapAuthentication()
            .ldapAuthoritiesPopulator(ldapAppAuthoritiesPopulator())
            .userSearchBase("OU=Users,DC=napo,DC=com")
            .userSearchFilter("(SamAccountName={0})")
            .contextSource()
            .root("dc=napo,dc=com")
            .managerDn("[email protected]")
            .managerPassword("XXX")
            .url("ldap://ldap.napo.com/OU=Users,dc=napo,dc=com");

The error message is: LDAP: error code 32 - 0000208D: NameErr: DSID-0310020A, problem 2001 (NO_OBJECT)

1

1 Answers

0
votes

The userSearchBase is relative to root. Remove DC=napo,DC=com from userSearchBase.