0

I have a Spring-Data LDAP repository configured as the following:

public interface LdapUserRepository extends LdapRepository<LdapUser> {

  Set<LdapUser> findByNameLike(String name);

  Optional<LdapUser> findByAccount(String account);

  Optional<LdapUser> findByEmail(String email);

  Optional<LdapUser>  findByEmailAndPassword(String email, String password);
}

Everything looks fine except by the fact that some attributes are being not fetched. For instance, I have an employeeID on LDAP user and being mapped on my LdapUser as the following:

  @Attribute(name = "employeeID", readonly = true)
  private String document;

I've checked and it's correctly populated on my directory: enter image description here

When I query an User through (e.g) Optional<LdapUser> findByAccount(String account) almost everything comes populated except by employeeID mappend on document field.

I'm also able to fetch it by querying it through a non-spring-data way.

Jaumzera
  • 2,305
  • 1
  • 30
  • 44

1 Answers1

0

Well, after two months I finally found the answer.

As mentioned on these answers: Get all attributes from Active Directory using Spring LdapTemplate, https://stackoverflow.com/a/56839626/3120564, some attributes are not propagated to the GC by default. So I had to change the connection port from 3269 to 389 and set the base attribute on the @Entry annotation to something more specific (e.g. OU=the_OU_I_want).

This solved my problem.

Jaumzera
  • 2,305
  • 1
  • 30
  • 44