Skip to content

Commit 2d488a6

Browse files
Fix inconsistent constructor declaration
Closes gh-16325 Signed-off-by: damable-nuvolex <damable@nuvolex.com>
1 parent 5517d8f commit 2d488a6

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

config/src/main/java/org/springframework/security/config/annotation/method/configuration/ReactiveAuthorizationManagerMethodSecurityConfiguration.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.security.config.annotation.method.configuration;
1818

19+
import java.util.Optional;
20+
1921
import org.aopalliance.intercept.MethodInterceptor;
2022
import org.aopalliance.intercept.MethodInvocation;
2123

@@ -83,15 +85,16 @@ final class ReactiveAuthorizationManagerMethodSecurityConfiguration
8385

8486
private final AuthorizationManagerAfterReactiveMethodInterceptor postAuthorizeMethodInterceptor;
8587

86-
@Autowired(required = false)
87-
ReactiveAuthorizationManagerMethodSecurityConfiguration(MethodSecurityExpressionHandler expressionHandler,
88+
@Autowired
89+
ReactiveAuthorizationManagerMethodSecurityConfiguration(Optional<MethodSecurityExpressionHandler> expressionHandler,
8890
ObjectProvider<ObjectPostProcessor<ReactiveAuthorizationManager<MethodInvocation>>> preAuthorizePostProcessor,
8991
ObjectProvider<ObjectPostProcessor<ReactiveAuthorizationManager<MethodInvocationResult>>> postAuthorizePostProcessor) {
90-
if (expressionHandler != null) {
91-
this.preFilterMethodInterceptor = new PreFilterAuthorizationReactiveMethodInterceptor(expressionHandler);
92-
this.preAuthorizeAuthorizationManager = new PreAuthorizeReactiveAuthorizationManager(expressionHandler);
93-
this.postFilterMethodInterceptor = new PostFilterAuthorizationReactiveMethodInterceptor(expressionHandler);
94-
this.postAuthorizeAuthorizationManager = new PostAuthorizeReactiveAuthorizationManager(expressionHandler);
92+
if (expressionHandler.isPresent()) {
93+
final MethodSecurityExpressionHandler handler = expressionHandler.get();
94+
this.preFilterMethodInterceptor = new PreFilterAuthorizationReactiveMethodInterceptor(handler);
95+
this.preAuthorizeAuthorizationManager = new PreAuthorizeReactiveAuthorizationManager(handler);
96+
this.postFilterMethodInterceptor = new PostFilterAuthorizationReactiveMethodInterceptor(handler);
97+
this.postAuthorizeAuthorizationManager = new PostAuthorizeReactiveAuthorizationManager(handler);
9598
}
9699
ReactiveAuthorizationManager<MethodInvocation> preAuthorize = preAuthorizePostProcessor
97100
.getIfUnique(ObjectPostProcessor::identity)

0 commit comments

Comments
 (0)