I have a ldap authentication for my spring application. In order to add special attributes for my customUserDetails, I made a CustomLdapUserDetailsMapper.
CustomLdapUserDetailsMapper