@@ -22,6 +22,7 @@ import org.junit.jupiter.api.extension.ExtendWith
2222import  org.springframework.beans.factory.annotation.Autowired 
2323import  org.springframework.context.annotation.Bean 
2424import  org.springframework.context.annotation.Configuration 
25+ import  org.springframework.http.converter.json.MappingJackson2HttpMessageConverter 
2526import  org.springframework.security.config.annotation.web.builders.HttpSecurity 
2627import  org.springframework.security.config.annotation.web.configuration.EnableWebSecurity 
2728import  org.springframework.security.config.test.SpringTestContext 
@@ -69,6 +70,16 @@ class WebAuthnDslTests {
6970            }
7071    }
7172
73+     @Test
74+     fun  `explicit HttpMessageConverter` 
75+         this .spring.register(ExplicitHttpMessageConverterConfig ::class .java).autowire()
76+ 
77+         this .mockMvc.post(" /test1" 
78+             .andExpect {
79+                 status { isForbidden() }
80+             }
81+     }
82+ 
7283    @Test
7384    fun  `webauthn and formLogin configured with default registration page` 
7485        spring.register(DefaultWebauthnConfig ::class .java).autowire()
@@ -166,6 +177,33 @@ class WebAuthnDslTests {
166177        }
167178    }
168179
180+     @Configuration
181+     @EnableWebSecurity
182+     open  class  ExplicitHttpMessageConverterConfig  {
183+         @Bean
184+         open  fun  securityFilterChain (http :  HttpSecurity ): SecurityFilterChain  {
185+             http {
186+                 webAuthn {
187+                     rpName =  " Spring Security Relying Party" 
188+                     rpId =  " example.com" 
189+                     allowedOrigins =  setOf (" https://example.com" 
190+                     messageConverter =  MappingJackson2HttpMessageConverter ()
191+                 }
192+             }
193+             return  http.build()
194+         }
195+ 
196+         @Bean
197+         open  fun  userDetailsService (): UserDetailsService  {
198+             val  userDetails =  User .withDefaultPasswordEncoder()
199+                 .username(" rod" 
200+                 .password(" password" 
201+                 .roles(" USER" 
202+                 .build()
203+             return  InMemoryUserDetailsManager (userDetails)
204+         }
205+     }
206+ 
169207    @Configuration
170208    @EnableWebSecurity
171209    open  class  WebauthnConfig  {
0 commit comments