Skip to content

Commit e7d5aa0

Browse files
committed
Add XML guidance to authorizeRequests deprecation warning
The deprecation warning for authorizeRequests and FilterSecurityInterceptor now also includes guidance for XML-based configuration, advising users to add use-authorization-manager=true to their http element. Closes gh-17259 Signed-off-by: hanweiwei <duzielww@163.com> Made-with: Cursor Signed-off-by: hanweiwei <duzielww@163.com> Made-with: Cursor
1 parent 1455798 commit e7d5aa0

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/builders/WebSecurityFilterChainValidator.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,15 @@ private void checkAuthorizationFilters(List<SecurityFilterChain> chains) {
103103
}
104104
if (authorizationFilter != null && filterSecurityInterceptor != null) {
105105
this.logger.warn(
106-
"It is not recommended to use authorizeRequests or FilterSecurityInterceptor in the configuration. Please only use authorizeHttpRequests");
106+
"It is not recommended to use authorizeRequests or FilterSecurityInterceptor in the configuration. "
107+
+ "Please only use authorizeHttpRequests. "
108+
+ "For XML configuration, please add use-authorization-manager=\"true\" to your <http> element.");
107109
}
108110
if (filterSecurityInterceptor != null) {
109111
this.logger.warn(
110-
"Usage of authorizeRequests and FilterSecurityInterceptor are deprecated. Please use authorizeHttpRequests in the configuration");
112+
"Usage of authorizeRequests and FilterSecurityInterceptor are deprecated. "
113+
+ "Please use authorizeHttpRequests in the configuration. "
114+
+ "For XML configuration, please add use-authorization-manager=\"true\" to your <http> element.");
111115
}
112116
authorizationFilter = null;
113117
filterSecurityInterceptor = null;

config/src/main/java/org/springframework/security/config/http/DefaultFilterChainValidator.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,15 @@ private void checkAuthorizationFilters(List<SecurityFilterChain> chains) {
130130
}
131131
if (authorizationFilter != null && filterSecurityInterceptor != null) {
132132
this.logger.warn(
133-
"It is not recommended to use authorizeRequests or FilterSecurityInterceptor in the configuration. Please only use authorizeHttpRequests");
133+
"It is not recommended to use authorizeRequests or FilterSecurityInterceptor in the configuration. "
134+
+ "Please only use authorizeHttpRequests. "
135+
+ "For XML configuration, please add use-authorization-manager=\"true\" to your <http> element.");
134136
}
135137
if (filterSecurityInterceptor != null) {
136138
this.logger.warn(
137-
"Usage of authorizeRequests and FilterSecurityInterceptor are deprecated. Please use authorizeHttpRequests in the configuration");
139+
"Usage of authorizeRequests and FilterSecurityInterceptor are deprecated. "
140+
+ "Please use authorizeHttpRequests in the configuration. "
141+
+ "For XML configuration, please add use-authorization-manager=\"true\" to your <http> element.");
138142
}
139143
authorizationFilter = null;
140144
filterSecurityInterceptor = null;

0 commit comments

Comments
 (0)