-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Closed
Labels
type: bugA general bugA general bug
Milestone
Description
Spring actuator will disable any configuration that has been specified in the spring boot configuration YAML file unless you have an explicit WebSecurityConfigurerAdapter
defined.
It took me a while to figure out why specifically integrating the new Spring Security 5.2 native support for saml2login which is demonstrated in the minimalist sample application. Simply adding actuator to that application will disable saml2. The reasons are the rules associated with the rules associated with ManagementWebSecurityAutoConfiguration.
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(WebSecurityConfigurerAdapter.class)
@ConditionalOnMissingBean(WebSecurityConfigurerAdapter.class)
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
@AutoConfigureBefore(SecurityAutoConfiguration.class)
@AutoConfigureAfter({ HealthEndpointAutoConfiguration.class, InfoEndpointAutoConfiguration.class,
WebEndpointAutoConfiguration.class, OAuth2ClientAutoConfiguration.class,
OAuth2ResourceServerAutoConfiguration.class })
@Import({ ManagementWebSecurityConfigurerAdapter.class, WebSecurityEnablerConfiguration.class })
public class ManagementWebSecurityAutoConfiguration {}
There are several problems with this:
- Boot tries to get configuration into the config files, not into the context of the application.
- It is defined to perform this configuration before
SecurityAutoConfiguration
which is again trying to circumvent the users configuration and enforce the configuration defined by actuator. - The underlying cause is the forceful nature of
ManagementWebSecurityConfigurerAdapter
enforcing forms based authentication.
In this the simplest separation of concerns is to NOT perform the following in ManagementWebSecurityConfigurerAdapter
:
http.formLogin(Customizer.withDefaults());
http.httpBasic(Customizer.withDefaults());
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug