title: Request LDAP for a user with the groups he is member of
body: <p>I'm discovering LDAP with Java.<br>
  I follow this guide to implement a solution to request the LDAP: <a href="https://docs.spring.io/spring-ldap/docs/current/reference/" rel="nofollow noreferrer">https://docs.spring.io/spring-ldap/docs/current/reference/</a></p>
  
  <p>I have been able to query user by login with the following code:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Entry(objectClasses = { "user" })
  public final class Person {
  
      @Id
      private Name dn;
  
      @Attribute(name = "sAMAccountName")
      String login;
  
      @Attribute(name = "cn")
      String name;
  
      ...
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>final LdapTemplate ldapTemplate;
  
  ...
  
  public Person consultPerson(final String login) {
      final LdapQuery findByLoginQuery = query() //
              .where("sAMAccountName") //
              .is(login);
  
      return ldapTemplate.findOne(findByLoginQuery, Person.class);
  }
  </code></pre>
  
  <p>Now, I want to get the list of group the user is member of.</p>
  
  <p>The following adjusment works but I would prefer to have a list of <code>Group</code> instead of a list of <code>String</code>.</p>
  
  <pre class="lang-java prettyprint-override"><code>@Entry(objectClasses = { "user" })
  public final class Person {
  
      @Id
      private Name dn;
  
      @Attribute(name = "sAMAccountName")
      String login;
  
      @Attribute(name = "cn")
      String name;
  
      @Attribute(name = "memberOf")
      Set&lt;String&gt; groups;
  
      ...
  }
  </code></pre>
  
  <p>Unfortunately, I'm not able to do so.</p>
  
  <p>Anybody knows if it's possible ?</p>
  
  <p>Thanks for your help.</p>