-
-
Notifications
You must be signed in to change notification settings - Fork 99
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
We can't use @WithJwt if the configuration does not expose an authentication converter bean
Code sample
Considering an app with spring-boot-starter-web, spring-boot-starter-oauth2-resource-server, spring-addons-oauth2-test and this minimal configuration:
@Configuration
@EnableMethodSecurity
public class SecurityConfig {
@Bean
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.oauth2ResourceServer(resourceServer -> {
resourceServer.jwt(Customizer.withDefaults());
});
http.authorizeHttpRequests(c -> c.anyRequest().permitAll());
return http.build();
}
}Any test attempting to use @WithJwt will crash because no authentication converter bean can be found
Expected behavior
Test framework should use the same default as Spring Boot and use a new JwtAuthenticationConverter() if no authentication converter could be found from the context.
Additional context
This is a follow-up of #158
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working