From 86f64e7e86f91fa2efb8dbf8bba2e17dd976c972 Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Thu, 12 Sep 2024 11:43:17 -0600 Subject: [PATCH] Add Reactive Authorization Proxy Data Hints Issue gh-15709 --- .../configuration/ReactiveMethodSecuritySelector.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/src/main/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecuritySelector.java b/config/src/main/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecuritySelector.java index 224d388b38..dbedbeab60 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecuritySelector.java +++ b/config/src/main/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecuritySelector.java @@ -26,6 +26,7 @@ import org.springframework.context.annotation.AutoProxyRegistrar; import org.springframework.context.annotation.ImportSelector; import org.springframework.core.type.AnnotationMetadata; import org.springframework.lang.NonNull; +import org.springframework.util.ClassUtils; /** * @author Rob Winch @@ -34,6 +35,9 @@ import org.springframework.lang.NonNull; */ class ReactiveMethodSecuritySelector implements ImportSelector { + private static final boolean isDataPresent = ClassUtils + .isPresent("org.springframework.security.data.aot.hint.AuthorizeReturnObjectDataHintsRegistrar", null); + private final ImportSelector autoProxy = new AutoProxyRegistrarSelector(); @Override @@ -51,6 +55,9 @@ class ReactiveMethodSecuritySelector implements ImportSelector { else { imports.add(ReactiveMethodSecurityConfiguration.class.getName()); } + if (isDataPresent) { + imports.add(AuthorizationProxyDataConfiguration.class.getName()); + } imports.add(AuthorizationProxyConfiguration.class.getName()); return imports.toArray(new String[0]); }