|
16 | 16 |
|
17 | 17 | package org.springframework.security.config.annotation.method.configuration; |
18 | 18 |
|
19 | | -import java.util.Optional; |
20 | | - |
21 | 19 | import org.aopalliance.intercept.MethodInterceptor; |
22 | 20 | import org.aopalliance.intercept.MethodInvocation; |
23 | 21 |
|
@@ -85,16 +83,16 @@ final class ReactiveAuthorizationManagerMethodSecurityConfiguration |
85 | 83 |
|
86 | 84 | private final AuthorizationManagerAfterReactiveMethodInterceptor postAuthorizeMethodInterceptor; |
87 | 85 |
|
88 | | - @Autowired |
89 | | - ReactiveAuthorizationManagerMethodSecurityConfiguration(Optional<MethodSecurityExpressionHandler> expressionHandler, |
| 86 | + ReactiveAuthorizationManagerMethodSecurityConfiguration( |
| 87 | + ObjectProvider<MethodSecurityExpressionHandler> expressionHandlers, |
90 | 88 | ObjectProvider<ObjectPostProcessor<ReactiveAuthorizationManager<MethodInvocation>>> preAuthorizePostProcessor, |
91 | 89 | ObjectProvider<ObjectPostProcessor<ReactiveAuthorizationManager<MethodInvocationResult>>> postAuthorizePostProcessor) { |
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); |
| 90 | + MethodSecurityExpressionHandler expressionHandler = expressionHandlers.getIfUnique(); |
| 91 | + if (expressionHandler != null) { |
| 92 | + this.preFilterMethodInterceptor = new PreFilterAuthorizationReactiveMethodInterceptor(expressionHandler); |
| 93 | + this.preAuthorizeAuthorizationManager = new PreAuthorizeReactiveAuthorizationManager(expressionHandler); |
| 94 | + this.postFilterMethodInterceptor = new PostFilterAuthorizationReactiveMethodInterceptor(expressionHandler); |
| 95 | + this.postAuthorizeAuthorizationManager = new PostAuthorizeReactiveAuthorizationManager(expressionHandler); |
98 | 96 | } |
99 | 97 | ReactiveAuthorizationManager<MethodInvocation> preAuthorize = preAuthorizePostProcessor |
100 | 98 | .getIfUnique(ObjectPostProcessor::identity) |
|
0 commit comments