diff --git a/web/src/main/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHints.java b/web/src/main/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHints.java index 9d49bc72bd..86df3618f2 100644 --- a/web/src/main/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHints.java +++ b/web/src/main/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHints.java @@ -27,6 +27,7 @@ import org.springframework.security.web.access.expression.WebSecurityExpressionR * {@link RuntimeHintsRegistrar} for WebMVC classes * * @author Marcus Da Coregio + * @author Daniel Garnier-Moiroux * @since 6.0 */ class WebMvcSecurityRuntimeHints implements RuntimeHintsRegistrar { @@ -47,6 +48,12 @@ class WebMvcSecurityRuntimeHints implements RuntimeHintsRegistrar { hints.resources().registerResource(css); } + ClassPathResource webauthnJavascript = new ClassPathResource( + "org/springframework/security/spring-security-webauthn.js"); + if (webauthnJavascript.exists()) { + hints.resources().registerResource(webauthnJavascript); + } + } } diff --git a/web/src/test/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHintsTests.java b/web/src/test/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHintsTests.java index 7ed25e570f..180d10db48 100644 --- a/web/src/test/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHintsTests.java +++ b/web/src/test/java/org/springframework/security/web/aot/hint/WebMvcSecurityRuntimeHintsTests.java @@ -68,4 +68,10 @@ class WebMvcSecurityRuntimeHintsTests { .accepts(this.hints); } + @Test + void webauthnJavascriptHasHints() { + assertThat(RuntimeHintsPredicates.resource() + .forResource("org/springframework/security/spring-security-webauthn.js")).accepts(this.hints); + } + }