Mandroid
Mandroid

Reputation: 7494

Spring LDAP unable to fetch record for external record

I am exploring spring security with LDAP. I have a code like this:

String LDAP_BASE = "OU=Employees,OU=User Accounts,dc=ad,dc=mycompany,dc=com"
ldapTemplate.search(LDAP_BASE, filter.encode(),searchControls, this::myMethod, 
      pagedResultsDirContextProcessor);

this::myMethod is a mapper function and entity it returns is as:

@Entry(base = "OU=Employees,OU=User Accounts,dc=ad,dc=mycompany,dc=com",
    objectClasses = {"person", "user", "top"})
public class User {
@Id
@JsonIgnore
private Name id;
.......}

I am facing an issue with this arrangement. If user is internal to the company, this code returns the user correctly. But if user is external, this code doesn't return any result, even though user record is there in LDAP directory.

How can I fetch users which are external to company but there in LDAP?

Upvotes: 0

Views: 50

Answers (1)

Ludovic Poitou
Ludovic Poitou

Reputation: 4878

The base of your search is where employees are stored in the directory tree: OU=Employees,OU=User Accounts,dc=ad,dc=mycompany,dc=com.

If you search from OU=User Accounts,dc=ad,dc=mycompany,dc=com, you should be able to find the external users, but that really depends on the structure of the LDAP directory in your company.

Upvotes: 1

Related Questions