Skip to content

Commit 641a480

Browse files
committed
Make RequestMatcherDelegatingAuthorizationManager Post-Processable
Closes gh-15978
1 parent 1911c39 commit 641a480

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ private AuthorizationManager<HttpServletRequest> createAuthorizationManager() {
170170
+ ". Try completing it with something like requestUrls().<something>.hasRole('USER')");
171171
Assert.state(this.mappingCount > 0,
172172
"At least one mapping is required (for example, authorizeHttpRequests().anyRequest().authenticated())");
173-
RequestMatcherDelegatingAuthorizationManager manager = postProcess(this.managerBuilder.build());
173+
AuthorizationManager<HttpServletRequest> manager = postProcess(
174+
(AuthorizationManager<HttpServletRequest>) this.managerBuilder.build());
174175
return AuthorizeHttpRequestsConfigurer.this.postProcessor.postProcess(manager);
175176
}
176177

config/src/test/java/org/springframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurerTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ public void configureWhenObjectPostProcessorRegisteredThenInvokedOnAuthorization
172172
ObjectPostProcessor<Object> objectPostProcessor = this.spring.getContext()
173173
.getBean(ObjectPostProcessorConfig.class).objectPostProcessor;
174174
verify(objectPostProcessor).postProcess(any(RequestMatcherDelegatingAuthorizationManager.class));
175+
verify(objectPostProcessor).postProcess(any(AuthorizationManager.class));
175176
verify(objectPostProcessor).postProcess(any(AuthorizationFilter.class));
176177
}
177178

0 commit comments

Comments
 (0)