ch4mpy / spring-addons

Ease spring OAuth2 resource-servers configuration and testing
Apache License 2.0
552 stars 89 forks source link

Exception is thrown with addons JWT starters when both spring-boot `issuer-uri` is provided in conf #87

Closed ch4mpy closed 1 year ago

ch4mpy commented 1 year ago

Describe the bug If spring.security.oauth2.resourceserver.jwt.issuer-uri is present in the properties file of a boot app with spring-addons-webmvc-jwt-resource-server or spring-addons-webflux-jwt-resource-server, an exception is thrown at startup and the resource-server shuts-down instantly.

Code sample Add spring.security.oauth2.resourceserver.jwt.issuer-uri=https://localhost:8443/realms/master to properties file of a working resource-server with spring-addons-webmvc-jwt-resource-server

Expected behavior The app should start.

ch4mpy commented 1 year ago

This is due to spring-addons doing its best to pick all issuers defined in properties, but parsing spring-boot properties for issuers actually introduces more confusion than good: for instance, what will be authorities mapping configuration for this issuer?

Will fix by ignoring spring.security.oauth2.resourceserver.jwt properties in spring-addons (with a WARNING in logs)