After I updated spring boot to 3.3.8 my basic authentication for swagger UI stopped working. Any ideas how to fix or why it stopped working? Tnx
Below is code I use to set it
@Configuration
@Order(1)
public static class ApiDocsWebSecurityConfig {
@Value("${swagger.security.user.name}")
private String username;
@Value("${swagger.security.user.password}")
private String password;
@Bean
public SecurityFilterChain configureOpenApiSecurity(HttpSecurity http) throws Exception {
return globalSecurityConfig(http)
.securityMatcher(OPENAPI_WS)
.authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated())
.userDetailsService(userDetailsService())
.httpBasic(Customizer.withDefaults())
.build();
}
private UserDetailsService userDetailsService() {
UserDetails user = User
.withUsername(username)
.password("{noop}" + password)
.roles("DOCS")
.build();
return new InMemoryUserDetailsManager(user);
}
}