If you've read and understood the explanations throughout this chapter, describing how Spring Security LDAP authentication works behind the scenes, this bean configuration will be perfectly understandable, albeit a bit complex. We'll configure LdapAuthenticationProvider
with the following characteristics:
User credential binding authentication (not password compare)
Use of the
InetOrgPerson
inUserDetailsContextMapper
Let's get to it—we'll explore the already configured LdapAuthenticationProvider
first:
src/main/webapp/WEB-INF/spring/security-ldap-explicitly.xml
<bean id="ldapAuthenticationProvider" class="org.springframework.security.ldap.authentication .LdapAuthenticationProvider"> <constructor-arg ref="ldapBindAuthenticator"/> <constructor-arg ref="ldapAuthoritiesPopulator"/> <property name="userDetailsContextMapper" ref="ldapUserDetailsContextMapper"/> </bean>
The next bean provided for us is BindAuthenticator...