Closed
Description
Description of the Bug
A warning appears on startup when configuring an OAuth2 Resource Server for an MVC application with an individual jwkSetUri
programmatically (e.g., not using the default spring boot property).
Configuration
Taken directly from https://docs.spring.io/spring-security/reference/5.8/servlet/oauth2/resource-server/jwt.html#oauth2resourceserver-jwt-jwkseturi-dsl:
@EnableWebSecurity
@Configuration
class SecurityConfiguration {
@Bean
fun securityChain(http: HttpSecurity) : SecurityFilterChain {
http {
authorizeRequests {
authorize(anyRequest, authenticated)
}
oauth2ResourceServer {
jwt {
jwkSetUri = "https://idp.example.com/.well-known/jwks.json"
}
}
}
return http.build()
}
}
Warning
2023-05-08T07:09:36.642+02:00 WARN 3586168 --- [ main] .s.s.UserDetailsServiceAutoConfiguration :
Using generated security password: bb3ffeca-0899-413b-89a8-5869721248c9
This generated password is for development use only. Your security configuration must be updated before running your application in production.
It seems that the UserDetailsServiceAutoConfiguration
is wrongfully activated.
Example repo
I've created a repository with a small example project to demonstrate the issue. This issue is present in spring boot 2.7.x (main branch of example repo) and spring boot 3.x (spring boot 3 branch of example repo).