You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/InitializeUserDetailsBeanManagerConfigurer.java
+44-58Lines changed: 44 additions & 58 deletions
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,6 @@
6
6
* You may obtain a copy of the License at
7
7
*
8
8
* https://www.apache.org/licenses/LICENSE-2.0
9
-
*
10
-
* Unless required by applicable law or agreed to in writing, software
11
-
* distributed under the License is distributed on an "AS IS" BASIS,
12
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-
* See the License for the specific language governing permissions and
// If user configured an AuthenticationProvider already, warn and bail
67
+
if (auth.isConfigured()) {
68
+
if (beanNames.length > 0) {
69
+
this.logger.warn(
70
+
"Global AuthenticationManager configured with an AuthenticationProvider bean. "
71
+
+ "UserDetailsService beans will not be used by Spring Security for automatically configuring username/password login. "
72
+
+ "Consider removing the AuthenticationProvider bean or configure DaoAuthenticationProvider manually.");
73
+
}
74
+
return;
75
+
}
76
+
77
+
// No UDS beans — nothing to do
73
78
if (beanNames.length == 0) {
74
79
return;
75
80
}
76
81
77
-
if (auth.isConfigured()) {
78
-
this.logger.warn("Global AuthenticationManager configured with an AuthenticationProvider bean. "
79
-
+ "UserDetailsService beans will not be used by Spring Security for automatically configuring username/password login. "
80
-
+ "Consider removing the AuthenticationProvider bean. "
81
-
+ "Alternatively, consider using the UserDetailsService in a manually instantiated DaoAuthenticationProvider. "
82
-
+ "If the current configuration is intentional, to turn off this warning, "
83
-
+ "increase the logging level of 'org.springframework.security.config.annotation.authentication.configuration.InitializeUserDetailsBeanManagerConfigurer' to ERROR");
82
+
/*
83
+
* Try to resolve a single autowire-candidate UDS from the container.
84
+
* getIfAvailable() returns:
85
+
* - the bean if there is exactly one, or
86
+
* - the @Primary bean if there are multiple and one is marked primary,
Copy file name to clipboardExpand all lines: config/src/test/java/org/springframework/security/config/annotation/authentication/configuration/InitializeUserDetailsBeanManagerConfigurerTests.java
+27-34Lines changed: 27 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,6 @@
6
6
* You may obtain a copy of the License at
7
7
*
8
8
* https://www.apache.org/licenses/LICENSE-2.0
9
-
*
10
-
* Unless required by applicable law or agreed to in writing, software
11
-
* distributed under the License is distributed on an "AS IS" BASIS,
12
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-
* See the License for the specific language governing permissions and
0 commit comments