-
Notifications
You must be signed in to change notification settings - Fork 41.3k
Skip actuator security autoconfig if resource server autoconfig is active #15472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ty configuration exists
@sdoxsee Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@sdoxsee Thank you for signing the Contributor License Agreement! |
@mbhave since you've triaged this one I was wondering if there wasn't a test missing there. Thoughts? |
I had the same thought but it didn't look like we write explicit tests for @sdoxsee Would you mind updating the PR with a test that adds |
@mbhave I'll give it a try when I have a chance over the next couple of weeks. Thanks |
@sdoxsee Thanks, no worries if you can't get to it. I can add the tests as part of the merge. |
…OAuth2ResourceServerAutoConfiguration are protected with Bearer
@mbhave Please let me know if you think this needs better/more tests. Thanks! |
...ate/autoconfigure/security/reactive/ReactiveManagementWebSecurityAutoConfigurationTests.java
Outdated
Show resolved
Hide resolved
...boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java
Outdated
Show resolved
Hide resolved
Thanks @sdoxsee. I left a comment on the commit. Let me know what you think. |
… ReactiveManagementWebSecurityAutoConfiguration and ManagementWebSecurityConfigurerAdapter when ReactiveOAuth2ResourceServerWebSecurityConfiguration and OAuth2ResourceServerWebSecurityConfiguration respectively should take priority
@mbhave Thanks for your suggestion. Pushed a commit to address it. Happy New Year! |
* gh-15472: Polish "Order actuator security config after resource-server config" Order actuator security config after resource-server config
Awesome. Thanks @mbhave |
I had a working Spring Boot 2.1.0 OAuth2 resource server application (with autoconfig based on https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-security-oauth2-server) but wanted to add the actuator. What happened was that the actuator security configuration autoconfiguration occurred before the OAuth2ResourceServerAutoconfiguration resulting in my endpoints becoming Basic-protected rather than OAuth2-protected.
I noticed that actuator security configuration was skipped if OAuth2 client autoconfiguration exists and figured that since resource server was new in 2.1.x that adding detection for its security configuration was missed (didn't see any tests for that level of detail...nor the right way to add tests for these "composed starter" cases).
I realize that this OAuth2-protects ALL the actuator endpoints (including the normally open health and info endpoints) but, without autoconfiguration detecting and creating a hybrid security config, this seemed to be this simplest logical solution and was more in line with the docs:
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-security-actuator