88import java .util .Optional ;
99import lombok .RequiredArgsConstructor ;
1010import lombok .extern .slf4j .Slf4j ;
11+ import org .springframework .beans .factory .annotation .Autowired ;
1112import org .springframework .boot .autoconfigure .condition .ConditionalOnProperty ;
1213import org .springframework .boot .context .properties .EnableConfigurationProperties ;
1314import org .springframework .context .ApplicationContext ;
@@ -53,14 +54,14 @@ public ReactiveAuthenticationManager authenticationManager(AbstractLdapAuthentic
5354
5455 @ Bean
5556 public AbstractLdapAuthenticationProvider authenticationProvider (LdapAuthoritiesPopulator authoritiesExtractor ,
56- BindAuthenticator bindAuthenticator ,
57+ @ Autowired ( required = false ) BindAuthenticator ba ,
5758 AccessControlService acs ) {
5859 var rbacEnabled = acs .isRbacEnabled ();
5960
6061 AbstractLdapAuthenticationProvider authProvider ;
6162
6263 if (!props .isActiveDirectory ()) {
63- authProvider = new LdapAuthenticationProvider (bindAuthenticator , authoritiesExtractor );
64+ authProvider = new LdapAuthenticationProvider (ba , authoritiesExtractor );
6465 } else {
6566 authProvider = new ActiveDirectoryLdapAuthenticationProvider (props .getActiveDirectoryDomain (),
6667 props .getUrls ());
@@ -76,6 +77,7 @@ public AbstractLdapAuthenticationProvider authenticationProvider(LdapAuthorities
7677 }
7778
7879 @ Bean
80+ @ ConditionalOnProperty (value = "oauth2.ldap.activeDirectory" , havingValue = "false" )
7981 public BindAuthenticator ldapBindAuthentication (LdapContextSource ldapContextSource ) {
8082 BindAuthenticator ba = new BindAuthenticator (ldapContextSource );
8183
0 commit comments