|
|
@ -51,7 +51,6 @@ import org.springframework.security.authentication.DefaultAuthenticationEventPub
|
|
|
|
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
|
|
|
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
|
|
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
|
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
|
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
|
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
|
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
|
|
|
|
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
|
import org.springframework.security.core.AuthenticationException;
|
|
|
|
import org.springframework.security.core.AuthenticationException;
|
|
|
|
import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension;
|
|
|
|
import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension;
|
|
|
@ -103,9 +102,12 @@ class SecurityAutoConfigurationTests {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
void securityConfigurerBacksOffWhenOtherWebSecurityAdapterBeanPresent() {
|
|
|
|
void securityConfigurerBacksOffWhenOtherWebSecurityAdapterBeanPresent() {
|
|
|
|
this.contextRunner.withUserConfiguration(WebSecurity.class).run((context) -> {
|
|
|
|
this.contextRunner.withUserConfiguration(WebSecurity.class).run((context) -> {
|
|
|
|
assertThat(context.getBeansOfType(WebSecurityConfigurerAdapter.class).size()).isEqualTo(1);
|
|
|
|
assertThat(context.getBeansOfType(
|
|
|
|
|
|
|
|
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.class)
|
|
|
|
|
|
|
|
.size()).isEqualTo(1);
|
|
|
|
assertThat(context.containsBean("securityAutoConfigurationTests.WebSecurity")).isTrue();
|
|
|
|
assertThat(context.containsBean("securityAutoConfigurationTests.WebSecurity")).isTrue();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -286,7 +288,9 @@ class SecurityAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@EnableWebSecurity
|
|
|
|
@EnableWebSecurity
|
|
|
|
static class WebSecurity extends WebSecurityConfigurerAdapter {
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
|
|
|
|
static class WebSecurity
|
|
|
|
|
|
|
|
extends org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|