diff --git a/build.gradle b/build.gradle index 405828ce9..13df51d12 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { ext{ //Plugins - springBootVersion = '3.3.4' + springBootVersion = '3.4.0' sonarqubeVersion = '6.0.1.5171' asciidoctorGradleVersion = "4.0.3" diff --git a/webauthn4j-spring-security-core/src/test/java/com/webauthn4j/springframework/security/config/configurers/WebAuthnAuthenticationProviderConfigurerSpringTest.java b/webauthn4j-spring-security-core/src/test/java/com/webauthn4j/springframework/security/config/configurers/WebAuthnAuthenticationProviderConfigurerSpringTest.java index 0ccf95bb7..b3d865b02 100644 --- a/webauthn4j-spring-security-core/src/test/java/com/webauthn4j/springframework/security/config/configurers/WebAuthnAuthenticationProviderConfigurerSpringTest.java +++ b/webauthn4j-spring-security-core/src/test/java/com/webauthn4j/springframework/security/config/configurers/WebAuthnAuthenticationProviderConfigurerSpringTest.java @@ -39,6 +39,7 @@ import org.springframework.web.servlet.handler.HandlerMappingIntrospector; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; @RunWith(SpringRunner.class) public class WebAuthnAuthenticationProviderConfigurerSpringTest { @@ -55,8 +56,10 @@ public void test() { @EnableWebSecurity static class Config { - @MockBean - private WebAuthnCredentialRecordService authenticatorService; + @Bean + public WebAuthnCredentialRecordService webAuthnCredentialRecordService(){ + return mock(WebAuthnCredentialRecordService.class); + } @Bean public ChallengeRepository challengeRepository() { @@ -100,8 +103,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { } @Bean - public AuthenticationManager authenticationManager(){ - return new ProviderManager(new WebAuthnAuthenticationProvider(authenticatorService, WebAuthnManager.createNonStrictWebAuthnManager())); + public AuthenticationManager authenticationManager(WebAuthnCredentialRecordService webAuthnCredentialRecordService) { + return new ProviderManager(new WebAuthnAuthenticationProvider(webAuthnCredentialRecordService, WebAuthnManager.createNonStrictWebAuthnManager())); } @Bean(name = "mvcHandlerMappingIntrospector") diff --git a/webauthn4j-spring-security-core/src/test/java/com/webauthn4j/springframework/security/config/configurers/WebAuthnLoginConfigurerSpringTest.java b/webauthn4j-spring-security-core/src/test/java/com/webauthn4j/springframework/security/config/configurers/WebAuthnLoginConfigurerSpringTest.java index eeedce0da..4e9910e18 100644 --- a/webauthn4j-spring-security-core/src/test/java/com/webauthn4j/springframework/security/config/configurers/WebAuthnLoginConfigurerSpringTest.java +++ b/webauthn4j-spring-security-core/src/test/java/com/webauthn4j/springframework/security/config/configurers/WebAuthnLoginConfigurerSpringTest.java @@ -98,7 +98,7 @@ public void attestationOptionsEndpointPath_with_anonymous_user_test() throws Exc mvc .perform(get("/webauthn/attestation/options").with(anonymous())) .andExpect(unauthenticated()) - .andExpect(content().json("{\"rp\":{\"id\":\"example.com\",\"name\":\"example\"},\"challenge\":\"aFglXMZdQTKD4krvNzJBzA\",\"pubKeyCredParams\":[{\"type\":\"public-key\",\"alg\":-7},{\"type\":\"public-key\",\"alg\":-65535}],\"timeout\":10000,\"excludeCredentials\":[],\"authenticatorSelection\":{\"authenticatorAttachment\":\"cross-platform\",\"requireResidentKey\":false,\"residentKey\":\"preferred\",\"userVerification\":\"preferred\"},\"attestation\":\"direct\",\"extensions\":{\"uvm\":true,\"credProps\":true,\"extensionProvider\":\"/webauthn/attestation/options\",\"unknown\":true}}", true)) + .andExpect(content().json("{\"rp\":{\"id\":\"example.com\",\"name\":\"example\"},\"challenge\":\"aFglXMZdQTKD4krvNzJBzA\",\"pubKeyCredParams\":[{\"type\":\"public-key\",\"alg\":-7},{\"type\":\"public-key\",\"alg\":-65535}],\"timeout\":10000,\"excludeCredentials\":[],\"authenticatorSelection\":{\"authenticatorAttachment\":\"cross-platform\",\"requireResidentKey\":false,\"residentKey\":\"preferred\",\"userVerification\":\"preferred\"},\"attestation\":\"direct\",\"extensions\":{\"uvm\":true,\"credProps\":true,\"extensionProvider\":\"/webauthn/attestation/options\",\"unknown\":true}}")) .andExpect(status().isOk()); } @@ -111,7 +111,7 @@ public void assertionOptionsEndpointPath_with_anonymous_user_test() throws Excep mvc .perform(get("/webauthn/assertion/options").with(anonymous())) .andExpect(unauthenticated()) - .andExpect(content().json("{\"challenge\":\"aFglXMZdQTKD4krvNzJBzA\",\"timeout\":20000,\"rpId\":\"example.com\",\"allowCredentials\":[],\"userVerification\":\"preferred\",\"extensions\":{\"appid\":\"appid\",\"appidExclude\":\"appidExclude\",\"uvm\":true,\"extensionProvider\":\"/webauthn/assertion/options\",\"unknown\":true}}", true)) + .andExpect(content().json("{\"challenge\":\"aFglXMZdQTKD4krvNzJBzA\",\"timeout\":20000,\"rpId\":\"example.com\",\"allowCredentials\":[],\"userVerification\":\"preferred\",\"extensions\":{\"appid\":\"appid\",\"appidExclude\":\"appidExclude\",\"uvm\":true,\"extensionProvider\":\"/webauthn/assertion/options\",\"unknown\":true}}")) .andExpect(status().isOk()); } @@ -138,7 +138,7 @@ public void attestationOptionsEndpointPath_with_authenticated_user_test() throws mvc .perform(get("/webauthn/attestation/options").with(user("john"))) .andExpect(authenticated()) - .andExpect(content().json("{\"rp\":{\"id\":\"example.com\",\"name\":\"example\"},\"user\":{\"id\":\"am9obg\",\"name\":\"john\",\"displayName\":\"john\"},\"challenge\":\"aFglXMZdQTKD4krvNzJBzA\",\"pubKeyCredParams\":[{\"type\":\"public-key\",\"alg\":-7},{\"type\":\"public-key\",\"alg\":-65535}],\"timeout\":10000,\"excludeCredentials\":[],\"authenticatorSelection\":{\"authenticatorAttachment\":\"cross-platform\",\"requireResidentKey\":false,\"residentKey\":\"preferred\",\"userVerification\":\"preferred\"},\"attestation\":\"direct\",\"extensions\":{\"uvm\":true,\"credProps\":true,\"extensionProvider\":\"/webauthn/attestation/options\",\"unknown\":true}}", true)) + .andExpect(content().json("{\"rp\":{\"id\":\"example.com\",\"name\":\"example\"},\"user\":{\"id\":\"am9obg\",\"name\":\"john\",\"displayName\":\"john\"},\"challenge\":\"aFglXMZdQTKD4krvNzJBzA\",\"pubKeyCredParams\":[{\"type\":\"public-key\",\"alg\":-7},{\"type\":\"public-key\",\"alg\":-65535}],\"timeout\":10000,\"excludeCredentials\":[],\"authenticatorSelection\":{\"authenticatorAttachment\":\"cross-platform\",\"requireResidentKey\":false,\"residentKey\":\"preferred\",\"userVerification\":\"preferred\"},\"attestation\":\"direct\",\"extensions\":{\"uvm\":true,\"credProps\":true,\"extensionProvider\":\"/webauthn/attestation/options\",\"unknown\":true}}")) .andExpect(status().isOk()); } @@ -154,7 +154,7 @@ public void assertionOptionsEndpointPath_with_authenticated_user_test() throws E .andDo(item -> item.getResponse().getContentAsString() ) - .andExpect(content().json("{\"challenge\":\"aFglXMZdQTKD4krvNzJBzA\",\"timeout\":20000,\"rpId\":\"example.com\",\"allowCredentials\":[],\"userVerification\":\"preferred\",\"extensions\":{\"appid\":\"appid\",\"appidExclude\":\"appidExclude\",\"uvm\":true,\"extensionProvider\":\"/webauthn/assertion/options\",\"unknown\":true}}", true)) + .andExpect(content().json("{\"challenge\":\"aFglXMZdQTKD4krvNzJBzA\",\"timeout\":20000,\"rpId\":\"example.com\",\"allowCredentials\":[],\"userVerification\":\"preferred\",\"extensions\":{\"appid\":\"appid\",\"appidExclude\":\"appidExclude\",\"uvm\":true,\"extensionProvider\":\"/webauthn/assertion/options\",\"unknown\":true}}")) .andExpect(status().isOk()); }