anchor.diff:  [source,kotlin,role="secondary"]
   ----
   @Bean
  -fun authenticator(contextSource: BaseLdapPathContextSource): PasswordComparisonAuthenticator {
  -    val authenticator = PasswordComparisonAuthenticator(contextSource)
  -    authenticator.setPasswordAttributeName("pwd") // <1>
  -    authenticator.setPasswordEncoder(BCryptPasswordEncoder()) // <2>
  -    return authenticator
  -}
  -
  -@Bean
  -fun authenticationProvider(authenticator: LdapAuthenticator): LdapAuthenticationProvider {
  -    return LdapAuthenticationProvider(authenticator)
  +fun authenticationManager(contextSource: BaseLdapPathContextSource): AuthenticationManager {
  +    val factory = LdapPasswordComparisonAuthenticationManagerFactory(
  +        contextSource, BCryptPasswordEncoder()
  +    )
  +    factory.setUserDnPatterns("uid={0},ou=people")
  +    factory.setPasswordAttribute("pwd") // <1>
  +    return factory.createAuthenticationManager()
   }
   ----
   ====
   
   <1> Specify the password attribute as `pwd`.
  -<2> Use `BCryptPasswordEncoder`.
  -
   
   == LdapAuthoritiesPopulator
   
  
positive.code: }
  
  @Bean
  LdapAuthenticationProvider authenticationProvider(LdapAuthenticator authenticator, LdapAuthoritiesPopulator authorities) {
  	return new LdapAuthenticationProvider(authenticator, authorities);
  }
  ----
  
  
negative.code: }
  
  @Bean
  fun authenticationManager(
      contextSource: BaseLdapPathContextSource,
      authorities: LdapAuthoritiesPopulator): AuthenticationManager {
      val factory = LdapBindAuthenticationManagerFactory(contextSource)
      factory.setUserDnPatterns("uid={0},ou=people")
      factory.setLdapAuthoritiesPopulator(authorities)
      return factory.createAuthenticationManager()
  }
  ----
  ====
  