Skip to content

Commit 18dba34

Browse files
codeconsolejzheaux
authored andcommitted
Make RequestMatcherDelegatingAuthorizationManager Post-Processable
Closes gh-15948
1 parent e9bbe31 commit 18dba34

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
@@ -171,7 +171,8 @@ private AuthorizationManager<HttpServletRequest> createAuthorizationManager() {
171171
Assert.state(this.mappingCount > 0,
172172
"At least one mapping is required (for example, authorizeHttpRequests().anyRequest().authenticated())");
173173
ObservationRegistry registry = getObservationRegistry();
174-
RequestMatcherDelegatingAuthorizationManager manager = postProcess(this.managerBuilder.build());
174+
AuthorizationManager<HttpServletRequest> manager = postProcess(
175+
(AuthorizationManager<HttpServletRequest>) this.managerBuilder.build());
175176
if (registry.isNoop()) {
176177
return manager;
177178
}

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
@@ -153,6 +153,7 @@ public void configureWhenObjectPostProcessorRegisteredThenInvokedOnAuthorization
153153
this.spring.register(ObjectPostProcessorConfig.class).autowire();
154154
ObjectPostProcessor objectPostProcessor = this.spring.getContext().getBean(ObjectPostProcessor.class);
155155
verify(objectPostProcessor).postProcess(any(RequestMatcherDelegatingAuthorizationManager.class));
156+
verify(objectPostProcessor).postProcess(any(AuthorizationManager.class));
156157
verify(objectPostProcessor).postProcess(any(AuthorizationFilter.class));
157158
}
158159

0 commit comments

Comments
 (0)