Skip to content

Commit 46fe012

Browse files
Kehrlannrwinch
authored andcommitted
Add RuntimeHints for webauthn Javascript resource
1 parent 409d552 commit 46fe012

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* {@link RuntimeHintsRegistrar} for WebMVC classes
2828
*
2929
* @author Marcus Da Coregio
30+
* @author Daniel Garnier-Moiroux
3031
* @since 6.0
3132
*/
3233
class WebMvcSecurityRuntimeHints implements RuntimeHintsRegistrar {
@@ -47,6 +48,12 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
4748
hints.resources().registerResource(css);
4849
}
4950

51+
ClassPathResource webauthnJavascript = new ClassPathResource(
52+
"org/springframework/security/spring-security-webauthn.js");
53+
if (webauthnJavascript.exists()) {
54+
hints.resources().registerResource(webauthnJavascript);
55+
}
56+
5057
}
5158

5259
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,10 @@ void cssHasHints() {
6868
.accepts(this.hints);
6969
}
7070

71+
@Test
72+
void webauthnJavascriptHasHints() {
73+
assertThat(RuntimeHintsPredicates.resource()
74+
.forResource("org/springframework/security/spring-security-webauthn.js")).accepts(this.hints);
75+
}
76+
7177
}

0 commit comments

Comments
 (0)