Configuring the UserDetailsContextMapper object
As we noted earlier, an instance of the o.s.s.ldap.userdetails.UserDetailsContextMapper
interface is used to map a user’s entry into the LDAP server to a UserDetails
object in memory. The default UserDetailsContextMapper
object behaves similarly to JpaDaoImpl
, given the level of detail that is populated on the returned UserDetails
object—that is to say, not a lot of information is returned besides the username and password.
However, an LDAP directory potentially contains many more details about individual users than usernames, passwords, and roles. Spring Security ships with two additional methods of pulling more user data from two of the standard LDAP object schemas—person
and inetOrgPerson
.
Implicit configuration of UserDetailsContextMapper
In order to configure a different UserDetailsContextMapper
implementation than the default, we simply need to declare which LdapUserDetails
class we want LdapAuthenticationProvider...