anchor.diff:  [source,kotlin,role="secondary",attrs="-attributes"]
   ----
   @Bean
  -fun authenticator(contextSource: BaseLdapPathContextSource): BindAuthenticator {
  -    val authenticator = BindAuthenticator(contextSource)
  -    authenticator.setUserDnPatterns(arrayOf("uid={0},ou=people"))
  -    return authenticator
  -}
  -
  -@Bean
  -fun authenticationProvider(authenticator: LdapAuthenticator): LdapAuthenticationProvider {
  -    return LdapAuthenticationProvider(authenticator)
  +fun authenticationManager(contextSource: BaseLdapPathContextSource): AuthenticationManager {
  +    val factory = LdapBindAuthenticationManagerFactory(contextSource)
  +    factory.setUserDnPatterns("uid={0},ou=people")
  +    return factory.createAuthenticationManager()
   }
   ----
   ====
  
positive.code: }
  
  @Bean
  fun authenticationProvider(authenticator: LdapAuthenticator, authorities: LdapAuthoritiesPopulator): LdapAuthenticationProvider {
      return LdapAuthenticationProvider(authenticator, authorities)
  }
  ----
  ====
  
negative.code: [source,java,role="primary"]
  ----
  @Bean
  AuthenticationManager authenticationManager(BaseLdapPathContextSource contextSource) {
  	LdapPasswordComparisonAuthenticationManagerFactory factory = new LdapPasswordComparisonAuthenticationManagerFactory(
  			contextSource, new BCryptPasswordEncoder());
  	factory.setUserDnPatterns("uid={0},ou=people");
  	factory.setPasswordAttribute("pwd");  // <1>
  	return factory.createAuthenticationManager();
  }
  ----
  
  