ExtendedLdapUserMapper extends LdapUserDetailsMapper { public void setGivenNameAttributeName(String givenNameAttributeName) { this.givenNameAttributeName = givenNameAttributeName; }  @Override UserDetails mapUserFromContext(DirContextOperations ctx, String username, Collection<? extends GrantedAuthority> authorities); String getMailAttributeName(); void setMailAttributeName(String mailAttributeName); String getPhoneNumberAttributeName(); void setPhoneNumberAttributeName(String phoneNumberAttributeName); String getGivenNameAttributeName(); void setGivenNameAttributeName(String givenNameAttributeName); String getFamilyNameAttributeName(); void setFamilyNameAttributeName(String familyNameAttributeName); String getMailSubstitute(); void setMailSubstitute(String mailSubstitute); boolean isMailSubstituteOverridesLdap(); void setMailSubstituteOverridesLdap(boolean mailSubstituteOverridesLdap); String getEmailVerifiedAttributeName(); void setEmailVerifiedAttributeName(String emailVerifiedAttributeName); static final String SUBSTITUTE_MAIL_ATTR_NAME; }
@Test public void testGivenNameAttributeNameMapping() throws Exception { attrs.put("givenName", "Marissa"); adapter = new DirContextAdapter(attrs, new LdapName("cn=marissa,ou=Users,dc=test,dc=com")); mapper.setGivenNameAttributeName("givenName"); ExtendedLdapUserImpl ldapUserDetails = getExtendedLdapUser(); Assert.assertThat(ldapUserDetails.getGivenName(), is("Marissa")); }