commit
b031a4c0f6
|
@ -43,6 +43,7 @@ import org.springframework.security.config.core.GrantedAuthorityDefaults;
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
*/
|
*/
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
|
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||||
class ReactiveMethodSecurityConfiguration implements ImportAware {
|
class ReactiveMethodSecurityConfiguration implements ImportAware {
|
||||||
|
|
||||||
private int advisorOrder;
|
private int advisorOrder;
|
||||||
|
@ -51,16 +52,17 @@ class ReactiveMethodSecurityConfiguration implements ImportAware {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||||
MethodSecurityMetadataSourceAdvisor methodSecurityInterceptor(AbstractMethodSecurityMetadataSource source) {
|
static MethodSecurityMetadataSourceAdvisor methodSecurityInterceptor(AbstractMethodSecurityMetadataSource source,
|
||||||
|
ReactiveMethodSecurityConfiguration configuration) {
|
||||||
MethodSecurityMetadataSourceAdvisor advisor = new MethodSecurityMetadataSourceAdvisor(
|
MethodSecurityMetadataSourceAdvisor advisor = new MethodSecurityMetadataSourceAdvisor(
|
||||||
"securityMethodInterceptor", source, "methodMetadataSource");
|
"securityMethodInterceptor", source, "methodMetadataSource");
|
||||||
advisor.setOrder(this.advisorOrder);
|
advisor.setOrder(configuration.advisorOrder);
|
||||||
return advisor;
|
return advisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||||
DelegatingMethodSecurityMetadataSource methodMetadataSource(
|
static DelegatingMethodSecurityMetadataSource methodMetadataSource(
|
||||||
MethodSecurityExpressionHandler methodSecurityExpressionHandler) {
|
MethodSecurityExpressionHandler methodSecurityExpressionHandler) {
|
||||||
ExpressionBasedAnnotationAttributeFactory attributeFactory = new ExpressionBasedAnnotationAttributeFactory(
|
ExpressionBasedAnnotationAttributeFactory attributeFactory = new ExpressionBasedAnnotationAttributeFactory(
|
||||||
methodSecurityExpressionHandler);
|
methodSecurityExpressionHandler);
|
||||||
|
@ -70,7 +72,7 @@ class ReactiveMethodSecurityConfiguration implements ImportAware {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
PrePostAdviceReactiveMethodInterceptor securityMethodInterceptor(AbstractMethodSecurityMetadataSource source,
|
static PrePostAdviceReactiveMethodInterceptor securityMethodInterceptor(AbstractMethodSecurityMetadataSource source,
|
||||||
MethodSecurityExpressionHandler handler) {
|
MethodSecurityExpressionHandler handler) {
|
||||||
ExpressionBasedPostInvocationAdvice postAdvice = new ExpressionBasedPostInvocationAdvice(handler);
|
ExpressionBasedPostInvocationAdvice postAdvice = new ExpressionBasedPostInvocationAdvice(handler);
|
||||||
ExpressionBasedPreInvocationAdvice preAdvice = new ExpressionBasedPreInvocationAdvice();
|
ExpressionBasedPreInvocationAdvice preAdvice = new ExpressionBasedPreInvocationAdvice();
|
||||||
|
@ -80,10 +82,11 @@ class ReactiveMethodSecurityConfiguration implements ImportAware {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||||
DefaultMethodSecurityExpressionHandler methodSecurityExpressionHandler() {
|
DefaultMethodSecurityExpressionHandler methodSecurityExpressionHandler(
|
||||||
|
ReactiveMethodSecurityConfiguration configuration) {
|
||||||
DefaultMethodSecurityExpressionHandler handler = new DefaultMethodSecurityExpressionHandler();
|
DefaultMethodSecurityExpressionHandler handler = new DefaultMethodSecurityExpressionHandler();
|
||||||
if (this.grantedAuthorityDefaults != null) {
|
if (configuration.grantedAuthorityDefaults != null) {
|
||||||
handler.setDefaultRolePrefix(this.grantedAuthorityDefaults.getRolePrefix());
|
handler.setDefaultRolePrefix(configuration.grantedAuthorityDefaults.getRolePrefix());
|
||||||
}
|
}
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue