Skip to content

Commit 69cbe12

Browse files
committed
Register Authorization Proxied Type
Closes gh-16106
1 parent 8971fb9 commit 69cbe12

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

core/src/main/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrar.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ private void registerProxy(RuntimeHints hints, Class<?> clazz) {
119119
}
120120
if (SpringProxy.class.isAssignableFrom(proxied)) {
121121
hints.reflection()
122-
.registerType(proxied, MemberCategory.INVOKE_PUBLIC_METHODS, MemberCategory.PUBLIC_FIELDS,
123-
MemberCategory.DECLARED_FIELDS);
122+
.registerType(clazz, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
123+
MemberCategory.INVOKE_DECLARED_METHODS)
124+
.registerType(proxied, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
125+
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS);
124126
}
125127
}
126128

core/src/test/java/org/springframework/security/aot/hint/AuthorizeReturnObjectCoreHintsRegistrarTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ public void registerHintsWhenUsingAuthorizeReturnObjectThenRegisters() {
4646
context.refresh();
4747
RuntimeHints hints = new RuntimeHints();
4848
this.registrar.registerHints(hints, context.getBeanFactory());
49-
assertThat(hints.reflection().typeHints().map((hint) -> hint.getType().getName()))
50-
.containsOnly(cglibClassName(MyObject.class), cglibClassName(MySubObject.class));
49+
assertThat(hints.reflection().typeHints().map((hint) -> hint.getType().getName())).containsOnly(
50+
cglibClassName(MyObject.class), cglibClassName(MySubObject.class), MyObject.class.getName(),
51+
MySubObject.class.getName());
5152
assertThat(hints.proxies()
5253
.jdkProxyHints()
5354
.flatMap((hint) -> hint.getProxiedInterfaces().stream())

core/src/test/java/org/springframework/security/aot/hint/AuthorizeReturnObjectHintsRegistrarTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void registerHintsWhenSpecifiedThenRegisters() {
4040
RuntimeHints hints = new RuntimeHints();
4141
registrar.registerHints(hints, null);
4242
assertThat(hints.reflection().typeHints().map((hint) -> hint.getType().getName()))
43-
.containsOnly(cglibClassName(MyObject.class));
43+
.containsOnly(cglibClassName(MyObject.class), MyObject.class.getName());
4444
assertThat(hints.proxies()
4545
.jdkProxyHints()
4646
.flatMap((hint) -> hint.getProxiedInterfaces().stream())

0 commit comments

Comments
 (0)