In another post, Harro had the same problem. I created my own UserDetailContextsMapper, extending LdapUserDetailsMapper, but that is really messy to extend..
Code:
public UserDetails mapUserFromContext(DirContextOperations ctx,
String username, GrantedAuthority[] authorities)
{
UserDetails ud = super.mapUserFromContext(ctx, username, authorities);
LdapUserDetailsImpl lud = (LdapUserDetailsImpl)ud;
DirContextAdapter dca = (DirContextAdapter)ctx;
Attributes atts = lud.getAttributes();
Enumeration e = dca.getAttributes().getAll();
while (e.hasMoreElements())
{
atts.put((Attribute)e.nextElement());
}
return ud;
}
just to get the LDAP attributes into the UserDetails, which I think the standard version should do anyway.
Maybe I'm going about this the wrong way, I thought I was trying to do something quite simple, but it's been a bit of a hack as I first had to understand the relationship between all these core implementation classes...
Antony