|
|
|
@ -21,6 +21,7 @@ import org.springframework.boot.TestUtils;
|
|
|
|
|
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
|
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.context.annotation.Import;
|
|
|
|
|
import org.springframework.mock.web.MockServletContext;
|
|
|
|
|
import org.springframework.security.authentication.AuthenticationManager;
|
|
|
|
|
import org.springframework.security.authentication.TestingAuthenticationToken;
|
|
|
|
@ -45,7 +46,7 @@ public class SecurityAutoConfigurationTests {
|
|
|
|
|
public void testWebConfiguration() throws Exception {
|
|
|
|
|
this.context = new AnnotationConfigWebApplicationContext();
|
|
|
|
|
this.context.setServletContext(new MockServletContext());
|
|
|
|
|
this.context.register(SecurityAutoConfiguration.class,
|
|
|
|
|
this.context.register(SecurityConfiguration.class,
|
|
|
|
|
EndpointAutoConfiguration.class,
|
|
|
|
|
ManagementServerPropertiesAutoConfiguration.class,
|
|
|
|
|
PropertyPlaceholderAutoConfiguration.class);
|
|
|
|
@ -60,7 +61,7 @@ public class SecurityAutoConfigurationTests {
|
|
|
|
|
public void testDisableIgnoredStaticApplicationPaths() throws Exception {
|
|
|
|
|
this.context = new AnnotationConfigWebApplicationContext();
|
|
|
|
|
this.context.setServletContext(new MockServletContext());
|
|
|
|
|
this.context.register(SecurityAutoConfiguration.class,
|
|
|
|
|
this.context.register(SecurityConfiguration.class,
|
|
|
|
|
EndpointAutoConfiguration.class,
|
|
|
|
|
ManagementServerPropertiesAutoConfiguration.class,
|
|
|
|
|
PropertyPlaceholderAutoConfiguration.class);
|
|
|
|
@ -75,7 +76,7 @@ public class SecurityAutoConfigurationTests {
|
|
|
|
|
public void testDisableBasicAuthOnApplicationPaths() throws Exception {
|
|
|
|
|
this.context = new AnnotationConfigWebApplicationContext();
|
|
|
|
|
this.context.setServletContext(new MockServletContext());
|
|
|
|
|
this.context.register(SecurityAutoConfiguration.class,
|
|
|
|
|
this.context.register(SecurityConfiguration.class,
|
|
|
|
|
EndpointAutoConfiguration.class,
|
|
|
|
|
ManagementServerPropertiesAutoConfiguration.class,
|
|
|
|
|
PropertyPlaceholderAutoConfiguration.class);
|
|
|
|
@ -99,6 +100,12 @@ public class SecurityAutoConfigurationTests {
|
|
|
|
|
this.context.getBean(AuthenticationManager.class));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Use this while SPR-11069 prevents us from checking OnMissingBean by annotation
|
|
|
|
|
@Configuration
|
|
|
|
|
@Import(SecurityAutoConfiguration.class)
|
|
|
|
|
protected static class SecurityConfiguration {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
|
protected static class TestConfiguration {
|
|
|
|
|
|
|
|
|
|