title: Spring Security - Retrieving Role of a User
body: <p>I am using OpenDS for Authentication of my Application. I am able to Authenticate the user successfully but not able get the roles of the user.
  The following is the configuration in the XML file.....</p>
  
  <pre><code>&lt;bean id="secondLdapProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider"&gt;
  &lt;constructor-arg&gt;
  &lt;bean class="org.springframework.security.ldap.authentication.BindAuthenticator"&gt;
  &lt;constructor-arg ref="contextSource" /&gt;
  &lt;property name="userSearch"&gt;
  &lt;bean id="userSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch"&gt;
  &lt;constructor-arg index="0" value="ou=people"/&gt;
  &lt;constructor-arg index="1" value="(uid={0})"/&gt;
  &lt;constructor-arg index="2" ref="contextSource" /&gt;
  &lt;/bean&gt;
  &lt;/property&gt;
  &lt;/bean&gt;
  &lt;/constructor-arg&gt;
  &lt;constructor-arg&gt;
  &lt;bean class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator"&gt;
  &lt;constructor-arg ref="contextSource" /&gt;
  &lt;constructor-arg value="ou=groups" /&gt;
  &lt;property name="groupSearchFilter" value="(member={0})"/&gt;
  &lt;property name="rolePrefix" value="ROLE_"/&gt;
  &lt;property name="searchSubtree" value="true"/&gt;
  &lt;property name="convertToUpperCase" value="true"/&gt;
  &lt;/bean&gt;
  &lt;/constructor-arg&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Please help me to get the roles.</p>