Skip to content

Commit 148e0b4

Browse files
Merge branch '6.1.x' into 6.2.x
Closes gh-14470
2 parents 237dd77 + ce5f5e6 commit 148e0b4

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

web/src/main/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHints.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -19,6 +19,7 @@
1919
import org.springframework.aot.hint.MemberCategory;
2020
import org.springframework.aot.hint.RuntimeHints;
2121
import org.springframework.aot.hint.RuntimeHintsRegistrar;
22+
import org.springframework.aot.hint.TypeReference;
2223
import org.springframework.security.web.access.expression.WebSecurityExpressionRoot;
2324

2425
/**
@@ -34,6 +35,11 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
3435
hints.reflection()
3536
.registerType(WebSecurityExpressionRoot.class, (builder) -> builder
3637
.withMembers(MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS));
38+
hints.reflection()
39+
.registerType(
40+
TypeReference
41+
.of("org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler$SupplierCsrfToken"),
42+
MemberCategory.INVOKE_DECLARED_METHODS);
3743
}
3844

3945
}

web/src/test/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHintsTests.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 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.
@@ -22,6 +22,7 @@
2222
import org.springframework.aot.hint.MemberCategory;
2323
import org.springframework.aot.hint.RuntimeHints;
2424
import org.springframework.aot.hint.RuntimeHintsRegistrar;
25+
import org.springframework.aot.hint.TypeReference;
2526
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
2627
import org.springframework.core.io.support.SpringFactoriesLoader;
2728
import org.springframework.security.web.access.expression.WebSecurityExpressionRoot;
@@ -53,4 +54,12 @@ void webSecurityExpressionRootHasHints() {
5354
.accepts(this.hints);
5455
}
5556

57+
@Test
58+
void supplierCsrfTokenHasHints() {
59+
assertThat(RuntimeHintsPredicates.reflection()
60+
.onType(TypeReference
61+
.of("org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler$SupplierCsrfToken"))
62+
.withMemberCategories(MemberCategory.INVOKE_DECLARED_METHODS)).accepts(this.hints);
63+
}
64+
5665
}

0 commit comments

Comments
 (0)