@@ -63,24 +63,32 @@ public ReactiveAuthenticationManager authenticationManager(LdapContextSource lda
63
63
ba .setUserSearch (userSearch );
64
64
}
65
65
66
+ var authenticationProvider = getAuthenticationProvider (authoritiesExtractor , rbacEnabled , ba );
67
+
68
+ AuthenticationManager am = new ProviderManager (List .of (authenticationProvider ));
69
+
70
+ return new ReactiveAuthenticationManagerAdapter (am );
71
+ }
72
+
73
+ private AbstractLdapAuthenticationProvider getAuthenticationProvider (LdapAuthoritiesPopulator authoritiesExtractor ,
74
+ boolean rbacEnabled ,
75
+ BindAuthenticator bindAuthenticator ) {
66
76
AbstractLdapAuthenticationProvider authenticationProvider ;
77
+
67
78
if (!props .isActiveDirectory ()) {
68
79
authenticationProvider = rbacEnabled
69
- ? new LdapAuthenticationProvider (ba , authoritiesExtractor )
70
- : new LdapAuthenticationProvider (ba );
80
+ ? new LdapAuthenticationProvider (bindAuthenticator , authoritiesExtractor )
81
+ : new LdapAuthenticationProvider (bindAuthenticator );
71
82
} else {
72
83
authenticationProvider = new ActiveDirectoryLdapAuthenticationProvider (props .getActiveDirectoryDomain (),
73
- props .getUrls ()); // TODO Issue #3741
84
+ props .getUrls ());
74
85
authenticationProvider .setUseAuthenticationRequestCredentials (true );
75
86
}
76
87
77
88
if (rbacEnabled ) {
78
89
authenticationProvider .setUserDetailsContextMapper (new UserDetailsMapper ());
79
90
}
80
-
81
- AuthenticationManager am = new ProviderManager (List .of (authenticationProvider ));
82
-
83
- return new ReactiveAuthenticationManagerAdapter (am );
91
+ return authenticationProvider ;
84
92
}
85
93
86
94
@ Bean
@@ -99,6 +107,10 @@ public DefaultLdapAuthoritiesPopulator ldapAuthoritiesExtractor(ApplicationConte
99
107
AccessControlService acs ) {
100
108
var rbacEnabled = acs != null && acs .isRbacEnabled ();
101
109
110
+ if (props .isActiveDirectory ()) {
111
+ return null ;
112
+ }
113
+
102
114
DefaultLdapAuthoritiesPopulator extractor ;
103
115
104
116
if (rbacEnabled ) {
0 commit comments