Remove @Configuration from @Enable* Annotations

This removes `@Configuration` from all `@Enable` Annotations and explicitly
adds `@Configuration` to wherever the `@Enable*` Annotations are used.

Closes gh-11653
This commit is contained in:
Rob Winch
2022-08-09 17:00:24 -05:00
243 changed files with 1379 additions and 20 deletions

View File

@@ -165,6 +165,7 @@ public class AuthenticationManagerBuilderTests {
.andExpect(authenticated().withUsername("joe").withRoles("USER"));
}
@Configuration
@EnableWebSecurity
static class MultiAuthenticationProvidersConfig extends WebSecurityConfigurerAdapter {
@@ -182,6 +183,7 @@ public class AuthenticationManagerBuilderTests {
}
@Configuration
@EnableWebSecurity
static class PasswordEncoderGlobalConfig extends WebSecurityConfigurerAdapter {
@@ -201,6 +203,7 @@ public class AuthenticationManagerBuilderTests {
}
@Configuration
@EnableWebSecurity
static class PasswordEncoderConfig extends WebSecurityConfigurerAdapter {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@@ -73,6 +74,7 @@ public class NamespaceAuthenticationManagerTests {
this.mockMvc.perform(formLogin()).andExpect(notNullCredentials);
}
@Configuration
@EnableWebSecurity
static class EraseCredentialsTrueDefaultConfig extends WebSecurityConfigurerAdapter {
@@ -87,6 +89,7 @@ public class NamespaceAuthenticationManagerTests {
}
@Configuration
@EnableWebSecurity
static class EraseCredentialsFalseConfig extends WebSecurityConfigurerAdapter {
@@ -102,6 +105,7 @@ public class NamespaceAuthenticationManagerTests {
}
@Configuration
@EnableWebSecurity
static class GlobalEraseCredentialsFalseConfig extends WebSecurityConfigurerAdapter {

View File

@@ -21,6 +21,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -60,6 +61,7 @@ public class NamespaceAuthenticationProviderTests {
this.mockMvc.perform(formLogin()).andExpect(authenticated().withUsername("user"));
}
@Configuration
@EnableWebSecurity
static class AuthenticationProviderRefConfig extends WebSecurityConfigurerAdapter {
@@ -80,6 +82,7 @@ public class NamespaceAuthenticationProviderTests {
}
@Configuration
@EnableWebSecurity
static class UserServiceRefConfig extends WebSecurityConfigurerAdapter {

View File

@@ -70,6 +70,7 @@ public class NamespaceJdbcUserServiceTests {
this.mockMvc.perform(formLogin()).andExpect(dba);
}
@Configuration
@EnableWebSecurity
static class JdbcUserServiceConfig extends WebSecurityConfigurerAdapter {
@@ -100,6 +101,7 @@ public class NamespaceJdbcUserServiceTests {
}
@Configuration
@EnableWebSecurity
static class CustomJdbcUserServiceSampleConfig extends WebSecurityConfigurerAdapter {

View File

@@ -23,6 +23,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
@@ -68,6 +69,7 @@ public class NamespacePasswordEncoderTests {
this.mockMvc.perform(formLogin()).andExpect(authenticated());
}
@Configuration
@EnableWebSecurity
static class PasswordEncoderWithInMemoryConfig extends WebSecurityConfigurerAdapter {
@@ -84,6 +86,7 @@ public class NamespacePasswordEncoderTests {
}
@Configuration
@EnableWebSecurity
static class PasswordEncoderWithJdbcConfig extends WebSecurityConfigurerAdapter {
@@ -108,6 +111,7 @@ public class NamespacePasswordEncoderTests {
}
@Configuration
@EnableWebSecurity
static class PasswordEncoderWithUserDetailsServiceConfig extends WebSecurityConfigurerAdapter {

View File

@@ -21,6 +21,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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.configuration.EnableWebSecurity;
@@ -55,6 +56,7 @@ public class PasswordEncoderConfigurerTests {
this.mockMvc.perform(formLogin()).andExpect(authenticated());
}
@Configuration
@EnableWebSecurity
static class PasswordEncoderConfig extends WebSecurityConfigurerAdapter {
@@ -80,6 +82,7 @@ public class PasswordEncoderConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class PasswordEncoderNoAuthManagerLoadsConfig extends WebSecurityConfigurerAdapter {

View File

@@ -21,6 +21,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.security.authentication.AuthenticationEventPublisher;
import org.springframework.security.authentication.AuthenticationManager;
@@ -57,6 +58,7 @@ public class AuthenticationConfigurationPublishTests {
this.authenticationManager = authenticationConfiguration.getAuthenticationManager();
}
@Configuration
@EnableGlobalAuthentication
@Import(AuthenticationTestConfiguration.class)
static class Config {

View File

@@ -296,16 +296,19 @@ public class AuthenticationConfigurationTests {
assertThatExceptionOfType(AlreadyBuiltException.class).isThrownBy(ap::build);
}
@Configuration
@EnableGlobalMethodSecurity(securedEnabled = true)
static class GlobalMethodSecurityAutowiredConfig {
}
@Configuration
@EnableWebSecurity
static class WebSecurityConfig {
}
@Configuration
@EnableWebMvcSecurity
static class WebMvcSecurityConfig {

View File

@@ -72,6 +72,7 @@ public class EnableGlobalAuthenticationTests {
}
@Configuration
@EnableGlobalAuthentication
static class BeanProxyEnabledByDefaultConfig {

View File

@@ -39,9 +39,9 @@ import org.springframework.util.Assert;
* @author Rob Winch
*
*/
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired

View File

@@ -28,6 +28,7 @@ import reactor.util.context.Context;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.TestingAuthenticationToken;
import org.springframework.security.core.context.ReactiveSecurityContextHolder;
@@ -402,6 +403,7 @@ public class EnableReactiveMethodSecurityTests {
return publisher(Flux.just(data));
}
@Configuration
@EnableReactiveMethodSecurity
static class Config {

View File

@@ -277,11 +277,13 @@ public class GlobalMethodSecurityConfigurationTests {
assertThat(methodInterceptor.getSecurityMetadataSource()).isSameAs(methodSecurityMetadataSource);
}
@Configuration
@EnableGlobalMethodSecurity
public static class IllegalStateGlobalMethodSecurityConfig extends GlobalMethodSecurityConfiguration {
}
@Configuration
@EnableGlobalMethodSecurity
public static class CustomMetadataSourceConfig extends GlobalMethodSecurityConfiguration {
@@ -293,6 +295,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class InMemoryAuthWithGlobalMethodSecurityConfig extends GlobalMethodSecurityConfiguration {
@@ -312,6 +315,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
static class CustomTrustResolverConfig {
@@ -327,6 +331,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true)
static class ExpressionHandlerHasBeanResolverSetConfig {
@@ -342,6 +347,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
static class MethodSecurityServiceConfig {
@@ -352,6 +358,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class AutowirePermissionEvaluatorConfig {
@@ -367,6 +374,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class MultiPermissionEvaluatorConfig {
@@ -387,6 +395,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
static class ParentConfig {
@@ -407,6 +416,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
static class Sec2479ChildConfig {
@@ -417,6 +427,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
static class Sec2815Config {
@@ -450,6 +461,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
static class Sec9845Config {
@@ -486,6 +498,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true, mode = AdviceMode.ASPECTJ)
@EnableTransactionManagement
static class Sec3005Config {
@@ -518,8 +531,8 @@ public class GlobalMethodSecurityConfigurationTests {
}
@EnableGlobalMethodSecurity(prePostEnabled = true)
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class RoleHierarchyConfig {
@Bean
@@ -536,6 +549,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
static class CustomGrantedAuthorityConfig {
@@ -564,6 +578,7 @@ public class GlobalMethodSecurityConfigurationTests {
}
@Configuration
@EnableGlobalMethodSecurity(securedEnabled = true)
static class EmptyRolePrefixGrantedAuthorityConfig {
@@ -592,8 +607,8 @@ public class GlobalMethodSecurityConfigurationTests {
}
@EnableGlobalMethodSecurity(prePostEnabled = true)
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class CustomMetadataSourceBeanProxyEnabledConfig extends GlobalMethodSecurityConfiguration {
}

View File

@@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler;
@@ -66,6 +67,7 @@ public class NamespaceGlobalMethodSecurityExpressionHandlerTests {
.isThrownBy(() -> this.service.postHasPermission("denied"));
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class CustomAccessDecisionManagerConfig extends GlobalMethodSecurityConfiguration {

View File

@@ -234,6 +234,7 @@ public class NamespaceGlobalMethodSecurityTests {
assertThatExceptionOfType(AccessDeniedException.class).isThrownBy(() -> this.service.preAuthorize());
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public static class CustomAccessDecisionManagerConfig extends GlobalMethodSecurityConfiguration {
@@ -264,6 +265,7 @@ public class NamespaceGlobalMethodSecurityTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class CustomAfterInvocationManagerConfig extends GlobalMethodSecurityConfiguration {
@@ -294,6 +296,7 @@ public class NamespaceGlobalMethodSecurityTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class CustomAuthenticationConfig extends GlobalMethodSecurityConfiguration {
@@ -313,12 +316,13 @@ public class NamespaceGlobalMethodSecurityTests {
}
@EnableGlobalMethodSecurity(jsr250Enabled = true)
@Configuration
@EnableGlobalMethodSecurity(jsr250Enabled = true)
public static class Jsr250Config {
}
@Configuration
@EnableGlobalMethodSecurity
public static class CustomMethodSecurityMetadataSourceConfig extends GlobalMethodSecurityConfiguration {
@@ -342,11 +346,13 @@ public class NamespaceGlobalMethodSecurityTests {
}
@Configuration
@EnableGlobalMethodSecurity(mode = AdviceMode.ASPECTJ, securedEnabled = true)
public static class AspectJModeConfig {
}
@Configuration
@EnableGlobalMethodSecurity(mode = AdviceMode.ASPECTJ, securedEnabled = true)
public static class AspectJModeExtendsGMSCConfig extends GlobalMethodSecurityConfiguration {
@@ -380,44 +386,52 @@ public class NamespaceGlobalMethodSecurityTests {
}
@Configuration
@EnableGlobalMethodSecurity(order = -135, jsr250Enabled = true)
@Import(AdvisorOrderConfig.class)
public static class CustomOrderConfig {
}
@Configuration
@EnableGlobalMethodSecurity(jsr250Enabled = true)
@Import(AdvisorOrderConfig.class)
public static class DefaultOrderConfig {
}
@Configuration
@EnableGlobalMethodSecurity(jsr250Enabled = true)
@Import(AdvisorOrderConfig.class)
public static class DefaultOrderExtendsMethodSecurityConfig extends GlobalMethodSecurityConfiguration {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class PreAuthorizeConfig {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class PreAuthorizeExtendsGMSCConfig extends GlobalMethodSecurityConfiguration {
}
@Configuration
@EnableGlobalMethodSecurity(proxyTargetClass = true, prePostEnabled = true)
public static class ProxyTargetClassConfig {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class DefaultProxyConfig {
}
@Configuration
@EnableGlobalMethodSecurity(securedEnabled = true)
public static class CustomRunAsManagerConfig extends GlobalMethodSecurityConfiguration {
@@ -430,6 +444,7 @@ public class NamespaceGlobalMethodSecurityTests {
}
@Configuration
@EnableGlobalMethodSecurity(securedEnabled = true)
public static class SecuredConfig {

View File

@@ -406,6 +406,7 @@ public class PrePostMethodSecurityConfigurationTests {
this.methodSecurityService.preAuthorizeBean(true);
}
@Configuration
@EnableMethodSecurity
static class MethodSecurityServiceConfig {
@@ -421,6 +422,7 @@ public class PrePostMethodSecurityConfigurationTests {
}
@Configuration
@EnableMethodSecurity(jsr250Enabled = true)
static class BusinessServiceConfig {
@@ -431,6 +433,7 @@ public class PrePostMethodSecurityConfigurationTests {
}
@Configuration
@EnableMethodSecurity(prePostEnabled = false, securedEnabled = true)
static class SecuredConfig {
@@ -441,6 +444,7 @@ public class PrePostMethodSecurityConfigurationTests {
}
@Configuration
@EnableMethodSecurity(prePostEnabled = false, jsr250Enabled = true)
static class Jsr250Config {
@@ -451,6 +455,7 @@ public class PrePostMethodSecurityConfigurationTests {
}
@Configuration
@EnableMethodSecurity(securedEnabled = true, jsr250Enabled = true)
static class MethodSecurityServiceEnabledConfig {
@@ -461,6 +466,7 @@ public class PrePostMethodSecurityConfigurationTests {
}
@Configuration
@EnableMethodSecurity
static class CustomPermissionEvaluatorConfig {
@@ -485,6 +491,7 @@ public class PrePostMethodSecurityConfigurationTests {
}
@Configuration
@EnableMethodSecurity
static class CustomGrantedAuthorityDefaultsConfig {
@@ -495,6 +502,7 @@ public class PrePostMethodSecurityConfigurationTests {
}
@Configuration
@EnableMethodSecurity
static class CustomAuthorizationManagerBeforeAdviceConfig {
@@ -513,6 +521,7 @@ public class PrePostMethodSecurityConfigurationTests {
}
@Configuration
@EnableMethodSecurity
static class CustomAuthorizationManagerAfterAdviceConfig {

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler;
@@ -75,6 +76,7 @@ public class SampleEnableGlobalMethodSecurityTests {
.isThrownBy(() -> this.methodSecurityService.hasPermission("denied"));
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
static class SampleWebSecurityConfig {
@@ -95,6 +97,7 @@ public class SampleEnableGlobalMethodSecurityTests {
}
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public static class CustomPermissionEvaluatorWebSecurityConfig extends GlobalMethodSecurityConfiguration {

View File

@@ -24,6 +24,7 @@ import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.PriorityOrdered;
import org.springframework.security.access.annotation.Jsr250MethodSecurityMetadataSource;
@@ -77,6 +78,7 @@ public class Sec2758Tests {
this.service.doPreAuthorize();
}
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, jsr250Enabled = true)
static class SecurityConfig extends WebSecurityConfigurerAdapter {

View File

@@ -19,6 +19,7 @@ package org.springframework.security.config.annotation.web;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockServletContext;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -73,6 +74,7 @@ public class AbstractRequestMatcherRegistryAnyMatcherTests {
context.refresh();
}
@Configuration
@EnableWebSecurity
static class AntMatchersAfterAnyRequestConfig extends WebSecurityConfigurerAdapter {
@@ -88,6 +90,7 @@ public class AbstractRequestMatcherRegistryAnyMatcherTests {
}
@Configuration
@EnableWebSecurity
static class MvcMatchersAfterAnyRequestConfig extends WebSecurityConfigurerAdapter {
@@ -103,6 +106,7 @@ public class AbstractRequestMatcherRegistryAnyMatcherTests {
}
@Configuration
@EnableWebSecurity
static class RegexMatchersAfterAnyRequestConfig extends WebSecurityConfigurerAdapter {
@@ -118,6 +122,7 @@ public class AbstractRequestMatcherRegistryAnyMatcherTests {
}
@Configuration
@EnableWebSecurity
static class AnyRequestAfterItselfConfig extends WebSecurityConfigurerAdapter {
@@ -133,6 +138,7 @@ public class AbstractRequestMatcherRegistryAnyMatcherTests {
}
@Configuration
@EnableWebSecurity
static class RequestMatchersAfterAnyRequestConfig extends WebSecurityConfigurerAdapter {

View File

@@ -86,6 +86,7 @@ public class HttpSecurityHeadersTests {
// @formatter:on
}
@Configuration
@EnableWebSecurity
static class WebSecurityConfig extends WebSecurityConfigurerAdapter {

View File

@@ -213,6 +213,7 @@ public class SampleWebSecurityConfigurerAdapterTests {
*
* @author Rob Winch
*/
@Configuration
@EnableWebSecurity
public static class HelloWorldWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
@@ -260,6 +261,7 @@ public class SampleWebSecurityConfigurerAdapterTests {
*
* @author Rob Winch
*/
@Configuration
@EnableWebSecurity
public static class SampleWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
@@ -333,6 +335,7 @@ public class SampleWebSecurityConfigurerAdapterTests {
*
* @author Rob Winch
*/
@Configuration
@EnableWebSecurity
public static class SampleMultiHttpSecurityConfig {

View File

@@ -27,6 +27,7 @@ import org.mockito.MockedStatic;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -110,6 +111,7 @@ public class WebSecurityConfigurerAdapterMockitoTests {
this.context = context;
}
@Configuration
@EnableWebSecurity
static class Config extends WebSecurityConfigurerAdapter {
@@ -137,6 +139,7 @@ public class WebSecurityConfigurerAdapterMockitoTests {
}
@Configuration
@EnableWebSecurity
static class WebAsyncPopulatedByDefaultConfig extends WebSecurityConfigurerAdapter {

View File

@@ -199,6 +199,7 @@ public class WebSecurityConfigurerAdapterTests {
any(Authentication.class));
}
@Configuration
@EnableWebSecurity
static class HeadersArePopulatedByDefaultConfig extends WebSecurityConfigurerAdapter {
@@ -217,6 +218,7 @@ public class WebSecurityConfigurerAdapterTests {
}
@Configuration
@EnableWebSecurity
static class InMemoryAuthWithWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter
implements ApplicationListener<AuthenticationSuccessEvent> {
@@ -239,6 +241,7 @@ public class WebSecurityConfigurerAdapterTests {
}
@Configuration
@EnableWebSecurity
static class InMemoryConfigureProtectedConfig extends WebSecurityConfigurerAdapter {
@@ -259,6 +262,7 @@ public class WebSecurityConfigurerAdapterTests {
}
@Configuration
@EnableWebSecurity
static class InMemoryConfigureGlobalConfig extends WebSecurityConfigurerAdapter {
@@ -279,6 +283,7 @@ public class WebSecurityConfigurerAdapterTests {
}
@Configuration
@EnableWebSecurity
static class OverrideContentNegotiationStrategySharedObjectConfig extends WebSecurityConfigurerAdapter {
@@ -299,6 +304,7 @@ public class WebSecurityConfigurerAdapterTests {
}
@Configuration
@EnableWebSecurity
static class ContentNegotiationStrategyDefaultSharedObjectConfig extends WebSecurityConfigurerAdapter {
@@ -322,6 +328,7 @@ public class WebSecurityConfigurerAdapterTests {
}
@Configuration
@EnableWebSecurity
static class UserDetailsServiceConfig extends WebSecurityConfigurerAdapter {
@@ -366,6 +373,7 @@ public class WebSecurityConfigurerAdapterTests {
}
@Configuration
@EnableWebSecurity
static class ApplicationContextSharedObjectConfig extends WebSecurityConfigurerAdapter {
@@ -379,6 +387,7 @@ public class WebSecurityConfigurerAdapterTests {
}
@Configuration
@EnableWebSecurity
static class CustomTrustResolverConfig extends WebSecurityConfigurerAdapter {
@@ -408,6 +417,7 @@ public class WebSecurityConfigurerAdapterTests {
}
@Configuration
@EnableWebSecurity
static class CustomAuthenticationEventPublisherBean extends WebSecurityConfigurerAdapter {
@@ -424,6 +434,7 @@ public class WebSecurityConfigurerAdapterTests {
}
@Configuration
@EnableWebSecurity
static class CustomAuthenticationEventPublisherDsl extends WebSecurityConfigurerAdapter {

View File

@@ -27,6 +27,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@@ -72,6 +73,7 @@ public class HttpConfigurationTests {
this.mockMvc.perform(get("/api/b")).andExpect(status().isUnauthorized());
}
@Configuration
@EnableWebSecurity
static class UnregisteredFilterConfig extends WebSecurityConfigurerAdapter {
@@ -104,6 +106,7 @@ public class HttpConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class RequestMatcherRegistryConfigs extends WebSecurityConfigurerAdapter {

View File

@@ -30,6 +30,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.test.SpringTestContext;
@@ -151,6 +152,7 @@ public class HttpSecurityAddFilterTest {
}
@Configuration
@EnableWebSecurity
static class MyFilterMultipleAfterConfig extends WebSecurityConfigurerAdapter {
@@ -165,6 +167,7 @@ public class HttpSecurityAddFilterTest {
}
@Configuration
@EnableWebSecurity
static class MyFilterMultipleBeforeConfig extends WebSecurityConfigurerAdapter {
@@ -179,6 +182,7 @@ public class HttpSecurityAddFilterTest {
}
@Configuration
@EnableWebSecurity
static class MyFilterMultipleAtConfig extends WebSecurityConfigurerAdapter {
@@ -193,6 +197,7 @@ public class HttpSecurityAddFilterTest {
}
@Configuration
@EnableWebSecurity
static class MyOtherFilterRelativeToMyFilterAfterConfig {
@@ -208,6 +213,7 @@ public class HttpSecurityAddFilterTest {
}
@Configuration
@EnableWebSecurity
static class MyOtherFilterRelativeToMyFilterBeforeConfig {
@@ -223,6 +229,7 @@ public class HttpSecurityAddFilterTest {
}
@Configuration
@EnableWebSecurity
static class MyOtherFilterRelativeToMyFilterAtConfig {
@@ -238,6 +245,7 @@ public class HttpSecurityAddFilterTest {
}
@Configuration
@EnableWebSecurity
static class MyOtherFilterBeforeToMyFilterMultipleAfterConfig {
@@ -254,6 +262,7 @@ public class HttpSecurityAddFilterTest {
}
@Configuration
@EnableWebSecurity
static class MyAnotherFilterRelativeToMyCustomFiltersMultipleConfig {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.TestingAuthenticationToken;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
@@ -73,6 +74,7 @@ public class HttpSecurityAuthenticationManagerTests {
verifyNoInteractions(AuthenticationManagerBuilderConfig.USER_DETAILS_SERVICE);
}
@Configuration
@EnableWebSecurity
static class AuthenticationManagerConfig extends WebSecurityConfigurerAdapter {
@@ -92,6 +94,7 @@ public class HttpSecurityAuthenticationManagerTests {
}
@Configuration
@EnableWebSecurity
static class AuthenticationManagerBuilderConfig extends WebSecurityConfigurerAdapter {

View File

@@ -25,6 +25,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.authentication.AuthenticationManager;
@@ -275,6 +276,7 @@ public class NamespaceHttpTests {
.isAssignableFrom(config.filterInvocationSecurityMetadataSourceType);
}
@Configuration
@EnableWebSecurity
static class AccessDecisionManagerRefConfig extends WebSecurityConfigurerAdapter {
@@ -292,6 +294,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class AccessDeniedPageConfig extends WebSecurityConfigurerAdapter {
@@ -310,6 +313,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class AuthenticationManagerRefConfig extends WebSecurityConfigurerAdapter {
@@ -333,6 +337,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class CreateSessionAlwaysConfig extends WebSecurityConfigurerAdapter {
@@ -350,6 +355,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class CreateSessionStatelessConfig extends WebSecurityConfigurerAdapter {
@@ -367,6 +373,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class IfRequiredConfig extends WebSecurityConfigurerAdapter {
@@ -387,6 +394,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class CreateSessionNeverConfig extends WebSecurityConfigurerAdapter {
@@ -404,6 +412,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class EntryPointRefConfig extends WebSecurityConfigurerAdapter {
@@ -423,6 +432,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class JaasApiProvisionConfig extends WebSecurityConfigurerAdapter {
@@ -436,6 +446,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class RealmConfig extends WebSecurityConfigurerAdapter {
@@ -453,6 +464,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class RequestMatcherAntConfig extends WebSecurityConfigurerAdapter {
@@ -466,6 +478,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class RequestMatcherRegexConfig extends WebSecurityConfigurerAdapter {
@@ -479,6 +492,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class RequestMatcherRefConfig extends WebSecurityConfigurerAdapter {
@@ -501,6 +515,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class SecurityNoneConfig extends WebSecurityConfigurerAdapter {
@@ -515,6 +530,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class SecurityContextRepoConfig extends WebSecurityConfigurerAdapter {
@@ -543,6 +559,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class ServletApiProvisionConfig extends WebSecurityConfigurerAdapter {
@@ -560,6 +577,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class ServletApiProvisionDefaultsConfig extends WebSecurityConfigurerAdapter {
@@ -587,6 +605,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class UseExpressionsConfig extends WebSecurityConfigurerAdapter {
@@ -616,6 +635,7 @@ public class NamespaceHttpTests {
}
@Configuration
@EnableWebSecurity
static class DisableUseExpressionsConfig extends WebSecurityConfigurerAdapter {

View File

@@ -237,6 +237,7 @@ public class WebSecurityTests {
}
@Configuration
@EnableWebSecurity
static class RequestRejectedHandlerConfig extends WebSecurityConfigurerAdapter {

View File

@@ -22,6 +22,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
@@ -75,6 +76,7 @@ public class AuthenticationPrincipalArgumentResolverTests {
// @formatter:on
}
@Configuration
@EnableWebSecurity
@EnableWebMvc
static class Config {

View File

@@ -100,6 +100,7 @@ public class EnableWebSecurityTests {
assertThat(parentBean.getChild()).isNotSameAs(childBean);
}
@Configuration
@EnableWebSecurity
static class SecurityConfig extends WebSecurityConfigurerAdapter {
@@ -136,11 +137,13 @@ public class EnableWebSecurityTests {
}
@Configuration
@EnableWebSecurity(debug = true)
static class DebugSecurityConfig extends WebSecurityConfigurerAdapter {
}
@Configuration
@EnableWebSecurity
@EnableWebMvc
static class AuthenticationPrincipalConfig extends WebSecurityConfigurerAdapter {
@@ -161,6 +164,7 @@ public class EnableWebSecurityTests {
}
@Configuration
@EnableWebSecurity
@EnableWebMvc
static class SecurityFilterChainAuthenticationPrincipalConfig {
@@ -182,6 +186,7 @@ public class EnableWebSecurityTests {
}
@Configuration
@EnableWebSecurity
static class BeanProxyEnabledByDefaultConfig extends WebSecurityConfigurerAdapter {

View File

@@ -269,6 +269,7 @@ public class HttpSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class DefaultWithFilterChainConfig {
@@ -279,6 +280,7 @@ public class HttpSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class AuthorizeRequestsConfig {
@@ -295,6 +297,7 @@ public class HttpSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class SecurityEnabledConfig {
@@ -329,6 +332,7 @@ public class HttpSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class AuthorizeHttpRequestsBeforeAuthorizeRequestsConfig {
@@ -348,6 +352,7 @@ public class HttpSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class AuthorizeHttpRequestsAfterAuthorizeRequestsConfig {

View File

@@ -25,6 +25,7 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.TestingAuthenticationToken;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.test.SpringTestContext;
@@ -212,6 +213,7 @@ public class OAuth2ClientConfigurationTests {
verifyNoInteractions(authorizedClientRepository);
}
@Configuration
@EnableWebMvc
@EnableWebSecurity
static class OAuth2AuthorizedClientArgumentResolverConfig extends WebSecurityConfigurerAdapter {
@@ -252,6 +254,7 @@ public class OAuth2ClientConfigurationTests {
}
@Configuration
@EnableWebMvc
@EnableWebSecurity
static class OAuth2AuthorizedClientRepositoryRegisteredTwiceConfig extends WebSecurityConfigurerAdapter {
@@ -289,6 +292,7 @@ public class OAuth2ClientConfigurationTests {
}
@Configuration
@EnableWebMvc
@EnableWebSecurity
static class ClientRegistrationRepositoryNotRegisteredConfig extends WebSecurityConfigurerAdapter {
@@ -306,6 +310,7 @@ public class OAuth2ClientConfigurationTests {
}
@Configuration
@EnableWebMvc
@EnableWebSecurity
static class ClientRegistrationRepositoryRegisteredTwiceConfig extends WebSecurityConfigurerAdapter {
@@ -343,6 +348,7 @@ public class OAuth2ClientConfigurationTests {
}
@Configuration
@EnableWebMvc
@EnableWebSecurity
static class AccessTokenResponseClientRegisteredTwiceConfig extends WebSecurityConfigurerAdapter {
@@ -380,6 +386,7 @@ public class OAuth2ClientConfigurationTests {
}
@Configuration
@EnableWebMvc
@EnableWebSecurity
static class OAuth2AuthorizedClientManagerRegisteredConfig extends WebSecurityConfigurerAdapter {

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.FatalBeanException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.test.SpringTestContext;
@@ -72,6 +73,7 @@ public class Sec2515Tests {
this.spring.register(SecurityConfig.class).autowire();
}
@Configuration
@EnableWebSecurity
static class StackOverflowSecurityConfig extends WebSecurityConfigurerAdapter {
@@ -83,6 +85,7 @@ public class Sec2515Tests {
}
@Configuration
@EnableWebSecurity
static class CustomBeanNameStackOverflowSecurityConfig extends WebSecurityConfigurerAdapter {
@@ -94,6 +97,7 @@ public class Sec2515Tests {
}
@Configuration
@EnableWebSecurity
static class CanLoadWithChildConfig extends WebSecurityConfigurerAdapter {
@@ -107,6 +111,7 @@ public class Sec2515Tests {
}
@Configuration
@EnableWebSecurity
static class SecurityConfig extends WebSecurityConfigurerAdapter {

View File

@@ -104,6 +104,7 @@ public class SecurityReactorContextConfigurationResourceServerTests {
verify(strategy, atLeastOnce()).getContext();
}
@Configuration
@EnableWebSecurity
static class BearerFilterConfig extends WebSecurityConfigurerAdapter {
@@ -120,6 +121,7 @@ public class SecurityReactorContextConfigurationResourceServerTests {
}
@Configuration
@EnableWebSecurity
static class BearerFilterlessConfig extends WebSecurityConfigurerAdapter {

View File

@@ -33,6 +33,7 @@ import reactor.core.publisher.Operators;
import reactor.test.StepVerifier;
import reactor.util.context.Context;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -268,6 +269,7 @@ public class SecurityReactorContextConfigurationTests {
verify(strategy, times(2)).getContext();
}
@Configuration
@EnableWebSecurity
static class SecurityConfig extends WebSecurityConfigurerAdapter {

View File

@@ -439,6 +439,7 @@ public class WebSecurityConfigurationTests {
assertThat(privilegeEvaluator.isAllowed("/another", user)).isTrue();
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class SortedWebSecurityConfigurerAdaptersConfig {
@@ -512,6 +513,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class SortedSecurityFilterChainConfig {
@@ -568,6 +570,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class OrderOnBeanDefinitionsSecurityFilterChainConfig {
@@ -607,6 +610,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class DuplicateOrderConfig {
@@ -643,6 +647,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class PrivilegeEvaluatorConfigurerAdapterConfig extends WebSecurityConfigurerAdapter {
@@ -655,6 +660,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class WebSecurityExpressionHandlerConfig extends WebSecurityConfigurerAdapter {
@@ -677,6 +683,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class NullWebSecurityExpressionHandlerConfig extends WebSecurityConfigurerAdapter {
@@ -687,6 +694,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class WebSecurityExpressionHandlerDefaultsConfig extends WebSecurityConfigurerAdapter {
@@ -701,6 +709,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class WebSecurityExpressionHandlerRoleHierarchyBeanConfig extends WebSecurityConfigurerAdapter {
@@ -713,6 +722,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class WebSecurityExpressionHandlerPermissionEvaluatorBeanConfig extends WebSecurityConfigurerAdapter {
@@ -736,6 +746,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class WebInvocationPrivilegeEvaluatorDefaultsConfig extends WebSecurityConfigurerAdapter {
@@ -750,6 +761,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class AuthorizeRequestsFilterChainConfig {
@@ -766,6 +778,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class DefaultExpressionHandlerSetsBeanResolverConfig extends WebSecurityConfigurerAdapter {
@@ -807,6 +820,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class ParentConfig extends WebSecurityConfigurerAdapter {
@@ -817,6 +831,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class ChildConfig extends WebSecurityConfigurerAdapter {
@@ -827,6 +842,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@Import(AuthenticationTestConfiguration.class)
@EnableGlobalAuthentication
static class GlobalAuthenticationWebSecurityConfigurerAdaptersConfig {
@@ -868,6 +884,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class AdapterAndFilterChainConfig {
@@ -904,6 +921,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class WebSecurityCustomizerConfig {
@@ -915,6 +933,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class CustomizerAndFilterChainConfig {
@@ -938,6 +957,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class CustomizerAndAdapterConfig {
@@ -965,6 +985,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class CustomizerAndAdapterIgnoringConfig {
@@ -986,6 +1007,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class OrderedCustomizerConfig {
@@ -1004,6 +1026,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class MultipleAuthenticationManagersConfig {
@@ -1072,6 +1095,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
static class TwoSecurityFilterChainConfig {
@@ -1095,6 +1119,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity(debug = true)
static class TwoSecurityFilterChainDebugConfig {
@@ -1118,6 +1143,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class MultipleSecurityFilterChainConfig {
@@ -1153,6 +1179,7 @@ public class WebSecurityConfigurationTests {
}
@Configuration
@EnableWebSecurity
@Import(AuthenticationTestConfiguration.class)
static class MultipleSecurityFilterChainIgnoringConfig {

View File

@@ -16,9 +16,11 @@
package org.springframework.security.config.annotation.web.configuration.sec2377.a;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class Sec2377AConfig extends WebSecurityConfigurerAdapter {

View File

@@ -16,9 +16,11 @@
package org.springframework.security.config.annotation.web.configuration.sec2377.b;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class Sec2377BConfig extends WebSecurityConfigurerAdapter {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.config.annotation.SecurityContextChangedListenerConfig;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
@@ -89,6 +90,7 @@ public class AnonymousConfigurerTests {
this.mockMvc.perform(get("/")).andExpect(status().isOk());
}
@Configuration
@EnableWebSecurity
@EnableWebMvc
static class InvokeTwiceDoesNotOverride extends WebSecurityConfigurerAdapter {
@@ -107,6 +109,7 @@ public class AnonymousConfigurerTests {
}
@Configuration
@EnableWebSecurity
@EnableWebMvc
static class AnonymousPrincipalInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -124,6 +127,7 @@ public class AnonymousConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AnonymousDisabledInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -150,6 +154,7 @@ public class AnonymousConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AnonymousWithDefaultsInLambdaConfig extends WebSecurityConfigurerAdapter {

View File

@@ -542,6 +542,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
this.mvc.perform(requestWithUser).andExpect(status().isForbidden());
}
@Configuration
@EnableWebSecurity
static class NoRequestsConfig {
@@ -556,6 +557,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NoRequestsNoParameterConfig {
@@ -571,6 +573,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class IncompleteMappingConfig {
@@ -585,6 +588,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class IncompleteMappingNoParameterConfig {
@@ -601,6 +605,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AfterAnyRequestConfig {
@@ -618,6 +623,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomAuthorizationManagerConfig {
@@ -636,6 +642,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomAuthorizationManagerNoParameterConfig {
@@ -654,6 +661,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig {
@@ -686,6 +694,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserAnyAuthorityConfig {
@@ -704,6 +713,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserAuthorityConfig {
@@ -722,6 +732,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserOrRoleAdminAuthorityConfig {
@@ -740,6 +751,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserConfig {
@@ -756,6 +768,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserOrAdminConfig {
@@ -772,6 +785,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DenyAllConfig {
@@ -790,6 +804,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class PermitAllConfig {
@@ -806,6 +821,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class InvokeTwiceDoesNotResetConfig {
@@ -825,6 +841,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebMvc
@EnableWebSecurity
static class ServletPathConfig {
@@ -842,6 +859,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AuthenticatedConfig {
@@ -860,6 +878,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ExpressionRoleUserConfig {
@@ -876,6 +895,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ExpressionRoleUserOrAdminConfig {
@@ -892,6 +912,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ExpressionIpAddressLocalhostConfig {
@@ -937,6 +958,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FullyAuthenticatedConfig {
@@ -960,6 +982,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RememberMeConfig {
@@ -983,6 +1006,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AnonymousConfig {

View File

@@ -25,6 +25,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.ObjectPostProcessor;
@@ -128,6 +129,7 @@ public class ChannelSecurityConfigurerTests {
this.mvc.perform(get("/test-3")).andExpect(redirectedUrl("https://localhost/test-3"));
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -158,6 +160,7 @@ public class ChannelSecurityConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DuplicateInvocationsDoesNotOverrideConfig extends WebSecurityConfigurerAdapter {
@@ -174,6 +177,7 @@ public class ChannelSecurityConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RequiresChannelInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -190,6 +194,7 @@ public class ChannelSecurityConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RequiresChannelWithTestUrlRedirectStrategy extends WebSecurityConfigurerAdapter {
@@ -221,6 +226,7 @@ public class ChannelSecurityConfigurerTests {
}
@Configuration
@EnableWebSecurity
@EnableWebMvc
static class RequiresChannelMultiMvcMatchersConfig {
@@ -248,6 +254,7 @@ public class ChannelSecurityConfigurerTests {
}
@Configuration
@EnableWebSecurity
@EnableWebMvc
static class RequiresChannelMultiMvcMatchersInLambdaConfig {

View File

@@ -26,6 +26,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -181,6 +182,7 @@ public class CorsConfigurerTests {
.andExpect(header().exists("X-Content-Type-Options"));
}
@Configuration
@EnableWebSecurity
static class DefaultCorsConfig extends WebSecurityConfigurerAdapter {
@@ -197,6 +199,7 @@ public class CorsConfigurerTests {
}
@Configuration
@EnableWebMvc
@EnableWebSecurity
static class MvcCorsConfig extends WebSecurityConfigurerAdapter {
@@ -225,6 +228,7 @@ public class CorsConfigurerTests {
}
@Configuration
@EnableWebMvc
@EnableWebSecurity
static class MvcCorsInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -254,6 +258,7 @@ public class CorsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ConfigSourceConfig extends WebSecurityConfigurerAdapter {
@@ -280,6 +285,7 @@ public class CorsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ConfigSourceInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -307,6 +313,7 @@ public class CorsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CorsFilterConfig extends WebSecurityConfigurerAdapter {
@@ -333,6 +340,7 @@ public class CorsConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CorsFilterInLambdaConfig extends WebSecurityConfigurerAdapter {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -79,6 +80,7 @@ public class CsrfConfigurerIgnoringRequestMatchersTests {
this.mvc.perform(put("/no-csrf")).andExpect(status().isOk());
}
@Configuration
@EnableWebSecurity
static class IgnoringRequestMatchers extends WebSecurityConfigurerAdapter {
@@ -96,6 +98,7 @@ public class CsrfConfigurerIgnoringRequestMatchersTests {
}
@Configuration
@EnableWebSecurity
static class IgnoringRequestInLambdaMatchers extends WebSecurityConfigurerAdapter {
@@ -115,6 +118,7 @@ public class CsrfConfigurerIgnoringRequestMatchersTests {
}
@Configuration
@EnableWebSecurity
static class IgnoringPathsAndMatchers extends WebSecurityConfigurerAdapter {
@@ -132,6 +136,7 @@ public class CsrfConfigurerIgnoringRequestMatchersTests {
}
@Configuration
@EnableWebSecurity
static class IgnoringPathsAndMatchersInLambdaConfig extends WebSecurityConfigurerAdapter {

View File

@@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -73,6 +74,7 @@ public class CsrfConfigurerNoWebMvcTests {
this.context = annotationConfigApplicationContext;
}
@Configuration
@EnableWebSecurity
static class EnableWebConfig extends WebSecurityConfigurerAdapter {
@@ -82,6 +84,7 @@ public class CsrfConfigurerNoWebMvcTests {
}
@Configuration
@EnableWebSecurity
static class EnableWebOverrideRequestDataConfig {
@@ -93,6 +96,7 @@ public class CsrfConfigurerNoWebMvcTests {
}
@Configuration
@EnableWebSecurity
static class EnableWebMvcConfig extends WebSecurityConfigurerAdapter {

View File

@@ -418,6 +418,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CsrfAppliedDefaultConfig extends WebSecurityConfigurerAdapter {
@@ -427,6 +428,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DisableCsrfConfig extends WebSecurityConfigurerAdapter {
@@ -441,6 +443,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DisableCsrfInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -454,6 +457,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DisableCsrfEnablesRequestCacheConfig extends WebSecurityConfigurerAdapter {
@@ -482,6 +486,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CsrfDisablesPostRequestFromRequestCacheConfig extends WebSecurityConfigurerAdapter {
@@ -512,6 +517,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class InvalidSessionUrlConfig extends WebSecurityConfigurerAdapter {
@@ -528,6 +534,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RequireCsrfProtectionMatcherConfig extends WebSecurityConfigurerAdapter {
@@ -544,6 +551,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RequireCsrfProtectionMatcherInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -559,6 +567,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CsrfTokenRepositoryConfig extends WebSecurityConfigurerAdapter {
@@ -586,6 +595,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CsrfTokenRepositoryInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -602,6 +612,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AccessDeniedHandlerConfig extends WebSecurityConfigurerAdapter {
@@ -618,6 +629,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultAccessDeniedHandlerForConfig extends WebSecurityConfigurerAdapter {
@@ -636,6 +648,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginConfig extends WebSecurityConfigurerAdapter {
@@ -649,6 +662,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class LogoutAllowsGetConfig extends WebSecurityConfigurerAdapter {
@@ -665,6 +679,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NullRequireCsrfProtectionMatcherConfig extends WebSecurityConfigurerAdapter {
@@ -679,6 +694,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultDoesNotCreateSession extends WebSecurityConfigurerAdapter {
@@ -706,6 +722,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NullAuthenticationStrategy extends WebSecurityConfigurerAdapter {
@@ -720,6 +737,7 @@ public class CsrfConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CsrfAuthenticationStrategyConfig extends WebSecurityConfigurerAdapter {

View File

@@ -131,6 +131,7 @@ public class DefaultFiltersTests {
assertThat(response.getRedirectedUrl()).isEqualTo("/login?logout");
}
@Configuration
@EnableWebSecurity
static class FilterChainProxyBuilderMissingConfig {
@@ -155,6 +156,7 @@ public class DefaultFiltersTests {
}
@Configuration
@EnableWebSecurity
static class NullWebInvocationPrivilegeEvaluatorConfig extends WebSecurityConfigurerAdapter {
@@ -169,6 +171,7 @@ public class DefaultFiltersTests {
}
@Configuration
@EnableWebSecurity
static class FilterChainProxyBuilderIgnoringConfig extends WebSecurityConfigurerAdapter {
@@ -192,6 +195,7 @@ public class DefaultFiltersTests {
}
@Configuration
@EnableWebSecurity
static class DefaultFiltersConfigPermitAll extends WebSecurityConfigurerAdapter {

View File

@@ -21,6 +21,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.security.config.annotation.ObjectPostProcessor;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
@@ -310,6 +311,7 @@ public class DefaultLoginPageConfigurerTests {
this.mvc.perform(get("/logout").with(user("user"))).andExpect(status().isNotFound());
}
@Configuration
@EnableWebSecurity
static class DefaultLoginPageConfig extends WebSecurityConfigurerAdapter {
@@ -335,6 +337,7 @@ public class DefaultLoginPageConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultLoginPageCustomLogoutSuccessHandlerConfig extends WebSecurityConfigurerAdapter {
@@ -354,6 +357,7 @@ public class DefaultLoginPageConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultLoginPageCustomLogoutSuccessUrlConfig extends WebSecurityConfigurerAdapter {
@@ -373,6 +377,7 @@ public class DefaultLoginPageConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultLoginPageWithRememberMeConfig extends WebSecurityConfigurerAdapter {
@@ -391,6 +396,7 @@ public class DefaultLoginPageConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultLoginWithCustomAuthenticationEntryPointConfig extends WebSecurityConfigurerAdapter {
@@ -410,6 +416,7 @@ public class DefaultLoginPageConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -432,6 +439,7 @@ public class DefaultLoginPageConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultLogoutPageConfig extends WebSecurityConfigurerAdapter {
@@ -448,6 +456,7 @@ public class DefaultLoginPageConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class LogoutDisabledConfig extends WebSecurityConfigurerAdapter {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -74,6 +75,7 @@ public class ExceptionHandlingConfigurerAccessDeniedHandlerTests {
this.mvc.perform(get("/goodbye")).andExpect(status().isIAmATeapot());
}
@Configuration
@EnableWebSecurity
static class RequestMatcherBasedAccessDeniedHandlerConfig extends WebSecurityConfigurerAdapter {
@@ -99,6 +101,7 @@ public class ExceptionHandlingConfigurerAccessDeniedHandlerTests {
}
@Configuration
@EnableWebSecurity
static class RequestMatcherBasedAccessDeniedHandlerInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -129,6 +132,7 @@ public class ExceptionHandlingConfigurerAccessDeniedHandlerTests {
}
@Configuration
@EnableWebSecurity
static class SingleRequestMatcherAccessDeniedHandlerConfig extends WebSecurityConfigurerAdapter {

View File

@@ -23,6 +23,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
@@ -228,6 +229,7 @@ public class ExceptionHandlingConfigurerTests {
any(HttpServletResponse.class), any(AuthenticationException.class));
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -257,6 +259,7 @@ public class ExceptionHandlingConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultSecurityConfig {
@@ -272,6 +275,7 @@ public class ExceptionHandlingConfigurerTests {
// @formatter:off
}
}
@Configuration
@EnableWebSecurity
static class HttpBasicAndFormLoginEntryPointsConfig extends WebSecurityConfigurerAdapter {
@Override
@@ -295,6 +299,7 @@ public class ExceptionHandlingConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OverrideContentNegotiationStrategySharedObjectConfig extends WebSecurityConfigurerAdapter {
@@ -307,11 +312,13 @@ public class ExceptionHandlingConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultHttpConfig extends WebSecurityConfigurerAdapter {
}
@Configuration
@EnableWebSecurity
static class BasicAuthenticationEntryPointBeforeFormLoginConfig extends WebSecurityConfigurerAdapter {
@@ -330,6 +337,7 @@ public class ExceptionHandlingConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class InvokeTwiceDoesNotOverrideConfig extends WebSecurityConfigurerAdapter {

View File

@@ -26,6 +26,7 @@ import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.access.event.AuthorizedEvent;
@@ -549,6 +550,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
this.mvc.perform(requestWithUser).andExpect(status().isForbidden());
}
@Configuration
@EnableWebSecurity
static class HasRoleStartingWithRoleConfig extends WebSecurityConfigurerAdapter {
@@ -563,6 +565,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NoSpecificAccessDecisionManagerConfig extends WebSecurityConfigurerAdapter {
@@ -584,6 +587,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NoRequestsConfig extends WebSecurityConfigurerAdapter {
@@ -597,6 +601,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class IncompleteMappingConfig extends WebSecurityConfigurerAdapter {
@@ -612,6 +617,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserAnyAuthorityConfig extends WebSecurityConfigurerAdapter {
@@ -628,6 +634,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserAuthorityConfig extends WebSecurityConfigurerAdapter {
@@ -644,6 +651,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserOrRoleAdminAuthorityConfig extends WebSecurityConfigurerAdapter {
@@ -660,6 +668,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserConfig extends WebSecurityConfigurerAdapter {
@@ -674,6 +683,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserWithTestRolePrefixConfig extends WebSecurityConfigurerAdapter {
@@ -693,6 +703,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserWithEmptyRolePrefixConfig extends WebSecurityConfigurerAdapter {
@@ -712,6 +723,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserOrAdminConfig extends WebSecurityConfigurerAdapter {
@@ -726,6 +738,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserOrAdminWithTestRolePrefixConfig extends WebSecurityConfigurerAdapter {
@@ -745,6 +758,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleUserOrAdminWithEmptyRolePrefixConfig extends WebSecurityConfigurerAdapter {
@@ -764,6 +778,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HasIpAddressConfig extends WebSecurityConfigurerAdapter {
@@ -780,6 +795,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AnonymousConfig extends WebSecurityConfigurerAdapter {
@@ -796,6 +812,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RememberMeConfig extends WebSecurityConfigurerAdapter {
@@ -823,6 +840,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DenyAllConfig extends WebSecurityConfigurerAdapter {
@@ -839,6 +857,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NotDenyAllConfig extends WebSecurityConfigurerAdapter {
@@ -855,6 +874,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FullyAuthenticatedConfig extends WebSecurityConfigurerAdapter {
@@ -873,6 +893,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AccessConfig extends WebSecurityConfigurerAdapter {
@@ -891,6 +912,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class InvokeTwiceDoesNotResetConfig extends WebSecurityConfigurerAdapter {
@@ -909,6 +931,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AllPropertiesWorkConfig extends WebSecurityConfigurerAdapter {
@@ -932,6 +955,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AuthorizedRequestsWithPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -961,6 +985,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class UseBeansInExpressions extends WebSecurityConfigurerAdapter {
@@ -991,6 +1016,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomExpressionRootConfig extends WebSecurityConfigurerAdapter {
@@ -1041,6 +1067,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class Sec3011Config extends WebSecurityConfigurerAdapter {
@@ -1070,6 +1097,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class PermissionEvaluatorConfig extends WebSecurityConfigurerAdapter {
@@ -1105,6 +1133,7 @@ public class ExpressionUrlAuthorizationConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RoleHierarchyConfig extends WebSecurityConfigurerAdapter {

View File

@@ -21,6 +21,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.config.annotation.ObjectPostProcessor;
import org.springframework.security.config.annotation.SecurityContextChangedListenerConfig;
@@ -375,6 +376,7 @@ public class FormLoginConfigurerTests {
verify(ObjectPostProcessorConfig.objectPostProcessor).postProcess(any(ExceptionTranslationFilter.class));
}
@Configuration
@EnableWebSecurity
static class RequestCacheConfig extends WebSecurityConfigurerAdapter {
@@ -392,6 +394,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RequestCacheBeanConfig {
@@ -402,6 +405,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginConfig extends WebSecurityConfigurerAdapter {
@@ -437,6 +441,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -463,6 +468,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginConfigPermitAll extends WebSecurityConfigurerAdapter {
@@ -480,6 +486,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginDefaultsConfig extends WebSecurityConfigurerAdapter {
@@ -501,6 +508,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginDefaultsInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -523,6 +531,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginLoginProcessingUrlConfig extends WebSecurityConfigurerAdapter {
@@ -559,6 +568,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginLoginProcessingUrlInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -597,6 +607,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginUsesPortMapperConfig extends WebSecurityConfigurerAdapter {
@@ -622,6 +633,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class PermitAllIgnoresFailureHandlerConfig extends WebSecurityConfigurerAdapter {
@@ -642,6 +654,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DuplicateInvocationsDoesNotOverrideConfig extends WebSecurityConfigurerAdapter {
@@ -667,6 +680,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginUserForwardAuthenticationSuccessAndFailureConfig extends WebSecurityConfigurerAdapter {
@@ -697,6 +711,7 @@ public class FormLoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.security.config.annotation.ObjectPostProcessor;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -58,6 +59,7 @@ public class HeadersConfigurerEagerHeadersTests {
.andExpect(header().string("X-XSS-Protection", "1; mode=block"));
}
@Configuration
@EnableWebSecurity
public static class HeadersAtTheBeginningOfRequestConfig extends WebSecurityConfigurerAdapter {

View File

@@ -27,6 +27,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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.WebSecurityConfigurerAdapter;
@@ -544,6 +545,7 @@ public class HeadersConfigurerTests {
HttpHeaders.CROSS_ORIGIN_EMBEDDER_POLICY, HttpHeaders.CROSS_ORIGIN_RESOURCE_POLICY);
}
@Configuration
@EnableWebSecurity
static class HeadersConfig extends WebSecurityConfigurerAdapter {
@@ -557,6 +559,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HeadersInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -570,6 +573,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ContentTypeOptionsConfig extends WebSecurityConfigurerAdapter {
@@ -585,6 +589,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ContentTypeOptionsInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -602,6 +607,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FrameOptionsConfig extends WebSecurityConfigurerAdapter {
@@ -617,6 +623,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HstsConfig extends WebSecurityConfigurerAdapter {
@@ -632,6 +639,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CacheControlConfig extends WebSecurityConfigurerAdapter {
@@ -647,6 +655,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CacheControlInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -664,6 +673,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class XssProtectionConfig extends WebSecurityConfigurerAdapter {
@@ -679,6 +689,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class XssProtectionInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -696,6 +707,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HeadersCustomSameOriginConfig extends WebSecurityConfigurerAdapter {
@@ -710,6 +722,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HeadersCustomSameOriginInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -726,6 +739,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HpkpConfigNoPins extends WebSecurityConfigurerAdapter {
@@ -741,6 +755,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HpkpConfig extends WebSecurityConfigurerAdapter {
@@ -757,6 +772,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HpkpConfigWithPins extends WebSecurityConfigurerAdapter {
@@ -776,6 +792,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HpkpConfigCustomAge extends WebSecurityConfigurerAdapter {
@@ -793,6 +810,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HpkpConfigTerminateConnection extends WebSecurityConfigurerAdapter {
@@ -810,6 +828,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HpkpConfigIncludeSubDomains extends WebSecurityConfigurerAdapter {
@@ -827,6 +846,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HpkpConfigWithReportURI extends WebSecurityConfigurerAdapter {
@@ -844,6 +864,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HpkpConfigWithReportURIAsString extends WebSecurityConfigurerAdapter {
@@ -861,6 +882,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HpkpWithReportUriInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -882,6 +904,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ContentSecurityPolicyDefaultConfig extends WebSecurityConfigurerAdapter {
@@ -897,6 +920,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ContentSecurityPolicyReportOnlyConfig extends WebSecurityConfigurerAdapter {
@@ -913,6 +937,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ContentSecurityPolicyReportOnlyInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -934,6 +959,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ContentSecurityPolicyInvalidConfig extends WebSecurityConfigurerAdapter {
@@ -949,6 +975,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ContentSecurityPolicyInvalidInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -968,6 +995,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ContentSecurityPolicyNoDirectivesInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -985,6 +1013,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ReferrerPolicyDefaultConfig extends WebSecurityConfigurerAdapter {
@@ -1000,6 +1029,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ReferrerPolicyDefaultInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -1017,6 +1047,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ReferrerPolicyCustomConfig extends WebSecurityConfigurerAdapter {
@@ -1032,6 +1063,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ReferrerPolicyCustomInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -1051,6 +1083,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FeaturePolicyConfig extends WebSecurityConfigurerAdapter {
@@ -1066,6 +1099,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FeaturePolicyInvalidConfig extends WebSecurityConfigurerAdapter {
@@ -1081,6 +1115,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class PermissionsPolicyConfig extends WebSecurityConfigurerAdapter {
@@ -1096,6 +1131,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class PermissionsPolicyStringConfig extends WebSecurityConfigurerAdapter {
@@ -1112,6 +1148,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class PermissionsPolicyInvalidConfig extends WebSecurityConfigurerAdapter {
@@ -1127,6 +1164,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class PermissionsPolicyInvalidStringConfig extends WebSecurityConfigurerAdapter {
@@ -1143,6 +1181,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HstsWithPreloadConfig extends WebSecurityConfigurerAdapter {
@@ -1159,6 +1198,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HstsWithPreloadInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -1176,6 +1216,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CrossOriginCustomPoliciesInLambdaConfig {
@@ -1200,6 +1241,7 @@ public class HeadersConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CrossOriginCustomPoliciesConfig {

View File

@@ -147,6 +147,7 @@ public class HttpBasicConfigurerTests {
verify(listener).securityContextChanged(setAuthentication(UsernamePasswordAuthenticationToken.class));
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -176,6 +177,7 @@ public class HttpBasicConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultsLambdaEntryPointConfig extends WebSecurityConfigurerAdapter {
@@ -201,6 +203,7 @@ public class HttpBasicConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultsEntryPointConfig extends WebSecurityConfigurerAdapter {
@@ -225,6 +228,7 @@ public class HttpBasicConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomAuthenticationEntryPointConfig extends WebSecurityConfigurerAdapter {
@@ -252,6 +256,7 @@ public class HttpBasicConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DuplicateDoesNotOverrideConfig extends WebSecurityConfigurerAdapter {
@@ -311,6 +316,7 @@ public class HttpBasicConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HttpBasic {

View File

@@ -88,6 +88,7 @@ public class Issue55Tests {
return this.spring.getContext().getBean(FilterChainProxy.class).getFilterChains().get(index);
}
@Configuration
@EnableWebSecurity
static class WebSecurityConfigurerAdapterDefaultsAuthManagerConfig {
@@ -117,6 +118,7 @@ public class Issue55Tests {
}
@Configuration
@EnableWebSecurity
static class MultiWebSecurityConfigurerAdapterDefaultsAuthManagerConfig {

View File

@@ -23,6 +23,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.ObjectPostProcessor;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -151,6 +152,7 @@ public class JeeConfigurerTests {
this.mvc.perform(authRequest).andExpect(authenticated().withRoles("USER"));
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -180,6 +182,7 @@ public class JeeConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class InvokeTwiceDoesNotOverride extends WebSecurityConfigurerAdapter {
@@ -196,6 +199,7 @@ public class JeeConfigurerTests {
}
@Configuration
@EnableWebSecurity
public static class JeeMappableRolesConfig extends WebSecurityConfigurerAdapter {
@@ -216,6 +220,7 @@ public class JeeConfigurerTests {
}
@Configuration
@EnableWebSecurity
public static class JeeMappableAuthoritiesConfig extends WebSecurityConfigurerAdapter {
@@ -236,6 +241,7 @@ public class JeeConfigurerTests {
}
@Configuration
@EnableWebSecurity
public static class JeeCustomAuthenticatedUserDetailsServiceConfig extends WebSecurityConfigurerAdapter {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
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.WebSecurityConfigurerAdapter;
@@ -87,6 +88,7 @@ public class LogoutConfigurerClearSiteDataTests {
this.mvc.perform(logoutRequest).andExpect(header().stringValues(CLEAR_SITE_DATA_HEADER, HEADER_VALUE));
}
@Configuration
@EnableWebSecurity
static class HttpLogoutConfig extends WebSecurityConfigurerAdapter {

View File

@@ -23,6 +23,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.security.config.annotation.ObjectPostProcessor;
import org.springframework.security.config.annotation.SecurityContextChangedListenerConfig;
@@ -321,6 +322,7 @@ public class LogoutConfigurerTests {
this.mvc.perform(post("/logout").with(csrf())).andExpect(status().isNotFound());
}
@Configuration
@EnableWebSecurity
static class NullLogoutSuccessHandlerConfig extends WebSecurityConfigurerAdapter {
@@ -335,6 +337,7 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NullLogoutSuccessHandlerInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -350,6 +353,7 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NullMatcherConfig extends WebSecurityConfigurerAdapter {
@@ -364,6 +368,7 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NullMatcherInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -379,6 +384,7 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -408,6 +414,7 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DuplicateDoesNotOverrideConfig extends WebSecurityConfigurerAdapter {
@@ -432,6 +439,7 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CsrfDisabledConfig extends WebSecurityConfigurerAdapter {
@@ -447,6 +455,7 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CsrfDisabledAndCustomLogoutConfig extends WebSecurityConfigurerAdapter {
@@ -463,6 +472,7 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CsrfDisabledAndCustomLogoutInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -478,6 +488,7 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NullLogoutHandlerConfig extends WebSecurityConfigurerAdapter {
@@ -492,6 +503,7 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NullLogoutHandlerInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -505,6 +517,7 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RememberMeNoLogoutHandler extends WebSecurityConfigurerAdapter {
@@ -521,11 +534,13 @@ public class LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class BasicSecurityConfig extends WebSecurityConfigurerAdapter {
}
@Configuration
@EnableWebSecurity
static class LogoutDisabledConfig extends WebSecurityConfigurerAdapter {

View File

@@ -25,6 +25,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.test.SpringTestContext;
@@ -84,11 +85,13 @@ public class NamespaceDebugTests {
return this.spring.getContext().getBean("springSecurityFilterChain").getClass();
}
@Configuration
@EnableWebSecurity(debug = true)
static class DebugWebSecurity extends WebSecurityConfigurerAdapter {
}
@Configuration
@EnableWebSecurity
static class NoDebugWebSecurity extends WebSecurityConfigurerAdapter {

View File

@@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -86,6 +87,7 @@ public class NamespaceHttpAnonymousTests {
this.mvc.perform(get("/principal")).andExpect(content().string("AnonymousUsernameConfig"));
}
@Configuration
@EnableWebSecurity
static class AnonymousConfig extends WebSecurityConfigurerAdapter {
@@ -101,6 +103,7 @@ public class NamespaceHttpAnonymousTests {
}
@Configuration
@EnableWebSecurity
static class AnonymousDisabledConfig extends WebSecurityConfigurerAdapter {
@@ -127,6 +130,7 @@ public class NamespaceHttpAnonymousTests {
}
@Configuration
@EnableWebSecurity
static class AnonymousGrantedAuthorityConfig extends WebSecurityConfigurerAdapter {
@@ -145,6 +149,7 @@ public class NamespaceHttpAnonymousTests {
}
@Configuration
@EnableWebSecurity
static class AnonymousKeyConfig extends WebSecurityConfigurerAdapter {
@@ -162,6 +167,7 @@ public class NamespaceHttpAnonymousTests {
}
@Configuration
@EnableWebSecurity
static class AnonymousUsernameConfig extends WebSecurityConfigurerAdapter {

View File

@@ -175,6 +175,7 @@ public class NamespaceHttpBasicTests {
}
@Configuration
@EnableWebSecurity
static class HttpBasicConfig extends WebSecurityConfigurerAdapter {
@@ -191,6 +192,7 @@ public class NamespaceHttpBasicTests {
}
@Configuration
@EnableWebSecurity
static class HttpBasicLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -208,6 +210,7 @@ public class NamespaceHttpBasicTests {
}
@Configuration
@EnableWebSecurity
static class CustomHttpBasicConfig extends WebSecurityConfigurerAdapter {
@@ -224,6 +227,7 @@ public class NamespaceHttpBasicTests {
}
@Configuration
@EnableWebSecurity
static class CustomHttpBasicLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -241,6 +245,7 @@ public class NamespaceHttpBasicTests {
}
@Configuration
@EnableWebSecurity
static class AuthenticationDetailsSourceHttpBasicConfig extends WebSecurityConfigurerAdapter {
@@ -263,6 +268,7 @@ public class NamespaceHttpBasicTests {
}
@Configuration
@EnableWebSecurity
static class AuthenticationDetailsSourceHttpBasicLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -285,6 +291,7 @@ public class NamespaceHttpBasicTests {
}
@Configuration
@EnableWebSecurity
static class EntryPointRefHttpBasicConfig extends WebSecurityConfigurerAdapter {
@@ -304,6 +311,7 @@ public class NamespaceHttpBasicTests {
}
@Configuration
@EnableWebSecurity
static class EntryPointRefHttpBasicLambdaConfig extends WebSecurityConfigurerAdapter {

View File

@@ -98,6 +98,7 @@ public class NamespaceHttpCustomFilterTests {
return assertThat(filters);
}
@Configuration
@EnableWebSecurity
static class CustomFilterBeforeConfig extends WebSecurityConfigurerAdapter {
@@ -112,6 +113,7 @@ public class NamespaceHttpCustomFilterTests {
}
@Configuration
@EnableWebSecurity
static class CustomFilterAfterConfig extends WebSecurityConfigurerAdapter {
@@ -126,6 +128,7 @@ public class NamespaceHttpCustomFilterTests {
}
@Configuration
@EnableWebSecurity
static class CustomFilterPositionConfig extends WebSecurityConfigurerAdapter {
@@ -146,6 +149,7 @@ public class NamespaceHttpCustomFilterTests {
}
@Configuration
@EnableWebSecurity
static class CustomFilterPositionAtConfig extends WebSecurityConfigurerAdapter {
@@ -164,6 +168,7 @@ public class NamespaceHttpCustomFilterTests {
}
@Configuration
@EnableWebSecurity
static class NoAuthenticationManagerInHttpConfigurationConfig extends WebSecurityConfigurerAdapter {

View File

@@ -23,6 +23,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
@@ -74,6 +75,7 @@ public class NamespaceHttpExpressionHandlerTests {
return verify(this.spring.getContext().getBean(beanName, beanClass));
}
@Configuration
@EnableWebMvc
@EnableWebSecurity
private static class ExpressionHandlerConfig extends WebSecurityConfigurerAdapter {

View File

@@ -22,6 +22,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@@ -69,11 +70,13 @@ public class NamespaceHttpFirewallTests {
this.mvc.perform(get("/").param("deny", "true")).andExpect(status().isBadRequest());
}
@Configuration
@EnableWebSecurity
static class HttpFirewallConfig {
}
@Configuration
@EnableWebSecurity
static class CustomHttpFirewallConfig extends WebSecurityConfigurerAdapter {
@@ -84,6 +87,7 @@ public class NamespaceHttpFirewallTests {
}
@Configuration
@EnableWebSecurity
static class CustomHttpFirewallBeanConfig {

View File

@@ -109,6 +109,7 @@ public class NamespaceHttpFormLoginTests {
return verify(this.spring.getContext().getBean(beanClass));
}
@Configuration
@EnableWebSecurity
static class FormLoginConfig extends WebSecurityConfigurerAdapter {
@@ -130,6 +131,7 @@ public class NamespaceHttpFormLoginTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginCustomConfig extends WebSecurityConfigurerAdapter {
@@ -153,6 +155,7 @@ public class NamespaceHttpFormLoginTests {
}
@Configuration
@EnableWebSecurity
static class FormLoginCustomRefsConfig extends WebSecurityConfigurerAdapter {

View File

@@ -25,6 +25,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
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.WebSecurityConfigurerAdapter;
@@ -150,6 +151,7 @@ public class NamespaceHttpHeadersTests {
};
}
@Configuration
@EnableWebSecurity
static class HeadersDefaultConfig extends WebSecurityConfigurerAdapter {
@@ -163,6 +165,7 @@ public class NamespaceHttpHeadersTests {
}
@Configuration
@EnableWebSecurity
static class HeadersCacheControlConfig extends WebSecurityConfigurerAdapter {
@@ -178,6 +181,7 @@ public class NamespaceHttpHeadersTests {
}
@Configuration
@EnableWebSecurity
static class HstsConfig extends WebSecurityConfigurerAdapter {
@@ -193,6 +197,7 @@ public class NamespaceHttpHeadersTests {
}
@Configuration
@EnableWebSecurity
static class HstsCustomConfig extends WebSecurityConfigurerAdapter {
@@ -212,6 +217,7 @@ public class NamespaceHttpHeadersTests {
}
@Configuration
@EnableWebSecurity
static class FrameOptionsSameOriginConfig extends WebSecurityConfigurerAdapter {
@@ -229,6 +235,7 @@ public class NamespaceHttpHeadersTests {
}
@Configuration
@EnableWebSecurity
static class FrameOptionsAllowFromConfig extends WebSecurityConfigurerAdapter {
@@ -246,6 +253,7 @@ public class NamespaceHttpHeadersTests {
}
@Configuration
@EnableWebSecurity
static class XssProtectionConfig extends WebSecurityConfigurerAdapter {
@@ -262,6 +270,7 @@ public class NamespaceHttpHeadersTests {
}
@Configuration
@EnableWebSecurity
static class XssProtectionCustomConfig extends WebSecurityConfigurerAdapter {
@@ -280,6 +289,7 @@ public class NamespaceHttpHeadersTests {
}
@Configuration
@EnableWebSecurity
static class ContentTypeOptionsConfig extends WebSecurityConfigurerAdapter {
@@ -296,6 +306,7 @@ public class NamespaceHttpHeadersTests {
}
@Configuration
@EnableWebSecurity
static class HeaderRefConfig extends WebSecurityConfigurerAdapter {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
@@ -104,6 +105,7 @@ public class NamespaceHttpInterceptUrlTests {
AuthorityUtils.createAuthorityList(role));
}
@Configuration
@EnableWebSecurity
static class HttpInterceptUrlConfig extends WebSecurityConfigurerAdapter {

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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.WebSecurityConfigurerAdapter;
@@ -94,6 +95,7 @@ public class NamespaceHttpJeeTests {
return verify(this.spring.getContext().getBean(beanClass));
}
@Configuration
@EnableWebSecurity
public static class JeeMappableRolesConfig extends WebSecurityConfigurerAdapter {
@@ -111,6 +113,7 @@ public class NamespaceHttpJeeTests {
}
@Configuration
@EnableWebSecurity
public static class JeeUserServiceRefConfig extends WebSecurityConfigurerAdapter {

View File

@@ -26,6 +26,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
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.WebSecurityConfigurerAdapter;
@@ -162,6 +163,7 @@ public class NamespaceHttpLogoutTests {
.is(new Condition<>(sessionPredicate, "sessionPredicate failed"));
}
@Configuration
@EnableWebSecurity
static class HttpLogoutConfig extends WebSecurityConfigurerAdapter {
@@ -171,6 +173,7 @@ public class NamespaceHttpLogoutTests {
}
@Configuration
@EnableWebSecurity
static class HttpLogoutDisabledInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -181,6 +184,7 @@ public class NamespaceHttpLogoutTests {
}
@Configuration
@EnableWebSecurity
static class CustomHttpLogoutConfig extends WebSecurityConfigurerAdapter {
@@ -198,6 +202,7 @@ public class NamespaceHttpLogoutTests {
}
@Configuration
@EnableWebSecurity
static class CustomHttpLogoutInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -216,6 +221,7 @@ public class NamespaceHttpLogoutTests {
}
@Configuration
@EnableWebSecurity
static class SuccessHandlerRefHttpLogoutConfig extends WebSecurityConfigurerAdapter {
@@ -232,6 +238,7 @@ public class NamespaceHttpLogoutTests {
}
@Configuration
@EnableWebSecurity
static class SuccessHandlerRefHttpLogoutInLambdaConfig extends WebSecurityConfigurerAdapter {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
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.configuration.EnableWebSecurity;
@@ -56,6 +57,7 @@ public class NamespaceHttpPortMappingsTests {
this.mvc.perform(get("https://localhost:9443/user")).andExpect(redirectedUrl("http://localhost:9080/user"));
}
@Configuration
@EnableWebSecurity
static class HttpInterceptUrlWithPortMapperConfig extends WebSecurityConfigurerAdapter {

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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.configuration.EnableWebSecurity;
@@ -78,6 +79,7 @@ public class NamespaceHttpRequestCacheTests {
return verify(this.spring.getContext().getBean(beanClass));
}
@Configuration
@EnableWebSecurity
static class RequestCacheRefConfig extends WebSecurityConfigurerAdapter {
@@ -110,6 +112,7 @@ public class NamespaceHttpRequestCacheTests {
}
@Configuration
@EnableWebSecurity
static class DefaultRequestCacheRefConfig extends WebSecurityConfigurerAdapter {

View File

@@ -23,6 +23,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -103,6 +104,7 @@ public class NamespaceHttpServerAccessDeniedHandlerTests {
return verify(this.spring.getContext().getBean(beanClass));
}
@Configuration
@EnableWebSecurity
static class AccessDeniedPageConfig extends WebSecurityConfigurerAdapter {
@@ -120,6 +122,7 @@ public class NamespaceHttpServerAccessDeniedHandlerTests {
}
@Configuration
@EnableWebSecurity
static class AccessDeniedPageInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -139,6 +142,7 @@ public class NamespaceHttpServerAccessDeniedHandlerTests {
}
@Configuration
@EnableWebSecurity
static class AccessDeniedHandlerRefConfig extends WebSecurityConfigurerAdapter {
@@ -161,6 +165,7 @@ public class NamespaceHttpServerAccessDeniedHandlerTests {
}
@Configuration
@EnableWebSecurity
static class AccessDeniedHandlerRefInLambdaConfig extends WebSecurityConfigurerAdapter {

View File

@@ -31,6 +31,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.security.authentication.AuthenticationDetailsSource;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
@@ -131,6 +132,7 @@ public class NamespaceHttpX509Tests {
return verify(this.spring.getContext().getBean(beanClass));
}
@Configuration
@EnableWebSecurity
@EnableWebMvc
public static class X509Config extends WebSecurityConfigurerAdapter {
@@ -157,6 +159,7 @@ public class NamespaceHttpX509Tests {
}
@Configuration
@EnableWebSecurity
@EnableWebMvc
static class AuthenticationDetailsSourceRefConfig extends WebSecurityConfigurerAdapter {
@@ -190,6 +193,7 @@ public class NamespaceHttpX509Tests {
}
@EnableWebMvc
@Configuration
@EnableWebSecurity
public static class SubjectPrincipalRegexConfig extends WebSecurityConfigurerAdapter {
@@ -217,6 +221,7 @@ public class NamespaceHttpX509Tests {
}
@EnableWebMvc
@Configuration
@EnableWebSecurity
public static class CustomPrincipalExtractorConfig extends WebSecurityConfigurerAdapter {
@@ -249,6 +254,7 @@ public class NamespaceHttpX509Tests {
}
@EnableWebMvc
@Configuration
@EnableWebSecurity
public static class UserDetailsServiceRefConfig extends WebSecurityConfigurerAdapter {
@@ -276,6 +282,7 @@ public class NamespaceHttpX509Tests {
}
@EnableWebMvc
@Configuration
@EnableWebSecurity
public static class AuthenticationUserDetailsServiceConfig extends WebSecurityConfigurerAdapter {

View File

@@ -254,11 +254,13 @@ public class NamespaceSessionManagementTests {
return new SessionResultMatcher();
}
@Configuration
@EnableWebSecurity
static class SessionManagementConfig extends WebSecurityConfigurerAdapter {
}
@Configuration
@EnableWebSecurity
static class CustomSessionManagementConfig extends WebSecurityConfigurerAdapter {
@@ -290,6 +292,7 @@ public class NamespaceSessionManagementTests {
}
@Configuration
@EnableWebSecurity
static class InvalidSessionStrategyConfig extends WebSecurityConfigurerAdapter {
@@ -311,6 +314,7 @@ public class NamespaceSessionManagementTests {
}
@Configuration
@EnableWebSecurity
static class RefsSessionManagementConfig extends WebSecurityConfigurerAdapter {
@@ -334,6 +338,7 @@ public class NamespaceSessionManagementTests {
}
@Configuration
@EnableWebSecurity
static class SFPNoneSessionManagementConfig extends WebSecurityConfigurerAdapter {
@@ -350,6 +355,7 @@ public class NamespaceSessionManagementTests {
}
@Configuration
@EnableWebSecurity
static class SFPMigrateSessionManagementConfig extends WebSecurityConfigurerAdapter {
@@ -365,6 +371,7 @@ public class NamespaceSessionManagementTests {
}
@Configuration
@EnableWebSecurity
static class SFPPostProcessedConfig extends WebSecurityConfigurerAdapter {
@@ -385,6 +392,7 @@ public class NamespaceSessionManagementTests {
}
@Configuration
@EnableWebSecurity
static class SFPNewSessionSessionManagementConfig extends WebSecurityConfigurerAdapter {

View File

@@ -21,6 +21,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.test.SpringTestContext;
@@ -84,6 +85,7 @@ public class PasswordManagementConfigurerTests {
.withMessage("changePasswordPage cannot be empty");
}
@Configuration
@EnableWebSecurity
static class PasswordManagementWithDefaultChangePasswordPageConfig {
@@ -98,6 +100,7 @@ public class PasswordManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class PasswordManagementWithCustomChangePasswordPageConfig {

View File

@@ -21,6 +21,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
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.WebSecurityConfigurerAdapter;
@@ -89,6 +90,7 @@ public class PermitAllSupportTests {
"permitAll only works with either HttpSecurity.authorizeRequests() or HttpSecurity.authorizeHttpRequests()");
}
@Configuration
@EnableWebSecurity
static class PermitAllConfig extends WebSecurityConfigurerAdapter {
@@ -107,6 +109,7 @@ public class PermitAllSupportTests {
}
@Configuration
@EnableWebSecurity
static class PermitAllConfigAuthorizeHttpRequests extends WebSecurityConfigurerAdapter {
@@ -125,6 +128,7 @@ public class PermitAllSupportTests {
}
@Configuration
@EnableWebSecurity
static class PermitAllConfigWithBothConfigs extends WebSecurityConfigurerAdapter {
@@ -146,6 +150,7 @@ public class PermitAllSupportTests {
}
@Configuration
@EnableWebSecurity
static class NoAuthorizedUrlsConfig extends WebSecurityConfigurerAdapter {

View File

@@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
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.WebSecurityConfigurerAdapter;
@@ -63,6 +64,7 @@ public class PortMapperConfigurerTests {
this.mockMvc.perform(get("http://localhost:543")).andExpect(redirectedUrl("https://localhost:123"));
}
@Configuration
@EnableWebSecurity
static class InvokeTwiceDoesNotOverride extends WebSecurityConfigurerAdapter {
@@ -82,6 +84,7 @@ public class PortMapperConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class HttpMapsToInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -102,6 +105,7 @@ public class PortMapperConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomPortMapperInLambdaConfig extends WebSecurityConfigurerAdapter {

View File

@@ -26,6 +26,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.security.authentication.RememberMeAuthenticationToken;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
@@ -302,6 +303,7 @@ public class RememberMeConfigurerTests {
this.mvc.perform(requestWithRememberme).andExpect(remembermeAuthentication);
}
@Configuration
@EnableWebSecurity
static class NullUserDetailsConfig extends WebSecurityConfigurerAdapter {
@@ -331,6 +333,7 @@ public class RememberMeConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -369,6 +372,7 @@ public class RememberMeConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DuplicateDoesNotOverrideConfig extends WebSecurityConfigurerAdapter {
@@ -403,6 +407,7 @@ public class RememberMeConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class UserDetailsServiceBeanConfig {
@@ -423,6 +428,7 @@ public class RememberMeConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RememberMeConfig extends WebSecurityConfigurerAdapter {
@@ -450,6 +456,7 @@ public class RememberMeConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RememberMeInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -477,6 +484,7 @@ public class RememberMeConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RememberMeCookieDomainConfig extends WebSecurityConfigurerAdapter {
@@ -505,6 +513,7 @@ public class RememberMeConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RememberMeCookieDomainInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -535,6 +544,7 @@ public class RememberMeConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RememberMeCookieNameAndRememberMeServicesConfig extends WebSecurityConfigurerAdapter {
@@ -567,6 +577,7 @@ public class RememberMeConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FallbackRememberMeKeyConfig extends RememberMeConfig {

View File

@@ -23,6 +23,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpSession;
@@ -299,6 +300,7 @@ public class RequestCacheConfigurerTests {
// @formatter:on
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -328,6 +330,7 @@ public class RequestCacheConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class InvokeTwiceDoesNotOverrideConfig extends WebSecurityConfigurerAdapter {
@@ -346,6 +349,7 @@ public class RequestCacheConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RequestCacheDefaultsConfig extends WebSecurityConfigurerAdapter {
@@ -362,6 +366,7 @@ public class RequestCacheConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RequestCacheDisabledConfig extends WebSecurityConfigurerAdapter {
@@ -373,6 +378,7 @@ public class RequestCacheConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RequestCacheDisabledInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -391,6 +397,7 @@ public class RequestCacheConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RequestCacheInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -409,6 +416,7 @@ public class RequestCacheConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomRequestCacheInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -430,6 +438,7 @@ public class RequestCacheConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultSecurityConfig {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
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.WebSecurityConfigurerAdapter;
@@ -67,6 +68,7 @@ public class RequestMatcherConfigurerTests {
// @formatter:on
}
@Configuration
@EnableWebSecurity
static class Sec2908Config extends WebSecurityConfigurerAdapter {
@@ -87,6 +89,7 @@ public class RequestMatcherConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AuthorizeRequestInLambdaConfig extends WebSecurityConfigurerAdapter {

View File

@@ -139,6 +139,7 @@ public class SecurityContextConfigurerTests {
assertThat(securityContext.getAuthentication()).isNotNull();
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -168,6 +169,7 @@ public class SecurityContextConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DuplicateDoesNotOverrideConfig extends WebSecurityConfigurerAdapter {
@@ -221,6 +223,7 @@ public class SecurityContextConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class SecurityContextWithDefaultsInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -244,6 +247,7 @@ public class SecurityContextConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class SecurityContextDisabledInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -267,6 +271,7 @@ public class SecurityContextConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class NullSecurityContextRepositoryInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -293,6 +298,7 @@ public class SecurityContextConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RequireExplicitSaveConfig extends WebSecurityConfigurerAdapter {

View File

@@ -211,6 +211,7 @@ public class ServletApiConfigurerTests {
}
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -240,6 +241,7 @@ public class ServletApiConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ServletApiConfig extends WebSecurityConfigurerAdapter {
@@ -259,6 +261,7 @@ public class ServletApiConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomEntryPointConfig extends WebSecurityConfigurerAdapter {
@@ -289,6 +292,7 @@ public class ServletApiConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DuplicateInvocationsDoesNotOverrideConfig extends WebSecurityConfigurerAdapter {
@@ -305,6 +309,7 @@ public class ServletApiConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class SharedTrustResolverConfig extends WebSecurityConfigurerAdapter {
@@ -320,6 +325,7 @@ public class ServletApiConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ServletApiWithDefaultsInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -333,6 +339,7 @@ public class ServletApiConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RolePrefixInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -361,6 +368,7 @@ public class ServletApiConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ServletApiWithLogoutConfig extends WebSecurityConfigurerAdapter {

View File

@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -106,6 +107,7 @@ public class SessionManagementConfigurerServlet31Tests {
repo.saveContext(securityContextImpl, requestResponseHolder.getRequest(), requestResponseHolder.getResponse());
}
@Configuration
@EnableWebSecurity
static class SessionManagementDefaultSessionFixationServlet31Config extends WebSecurityConfigurerAdapter {

View File

@@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
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.configuration.EnableWebSecurity;
@@ -58,6 +59,7 @@ public class SessionManagementConfigurerSessionAuthenticationStrategyTests {
any(Authentication.class), any(HttpServletRequest.class), any(HttpServletResponse.class));
}
@Configuration
@EnableWebSecurity
static class CustomSessionAuthenticationStrategyConfig extends WebSecurityConfigurerAdapter {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
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.WebSecurityConfigurerAdapter;
@@ -71,6 +72,7 @@ public class SessionManagementConfigurerSessionCreationPolicyTests {
assertThat(result.getRequest().getSession(false)).isNotNull();
}
@Configuration
@EnableWebSecurity
static class StatelessCreateSessionSharedObjectConfig extends WebSecurityConfigurerAdapter {
@@ -82,6 +84,7 @@ public class SessionManagementConfigurerSessionCreationPolicyTests {
}
@Configuration
@EnableWebSecurity
static class StatelessCreateSessionUserConfig extends WebSecurityConfigurerAdapter {
@@ -97,6 +100,7 @@ public class SessionManagementConfigurerSessionCreationPolicyTests {
}
@Configuration
@EnableWebSecurity
static class DefaultConfig extends WebSecurityConfigurerAdapter {

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.security.authentication.AuthenticationTrustResolver;
import org.springframework.security.config.annotation.ObjectPostProcessor;
@@ -339,6 +340,7 @@ public class SessionManagementConfigurerTests {
this.mvc.perform(get("/")).andExpect(content().string("encoded"));
}
@Configuration
@EnableWebSecurity
static class SessionManagementRequestCacheConfig extends WebSecurityConfigurerAdapter {
@@ -358,6 +360,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class SessionManagementSecurityContextRepositoryConfig extends WebSecurityConfigurerAdapter {
@@ -377,6 +380,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class InvokeTwiceDoesNotOverride extends WebSecurityConfigurerAdapter {
@@ -393,6 +397,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DisableSessionFixationEnableConcurrencyControlConfig extends WebSecurityConfigurerAdapter {
@@ -419,6 +424,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class SFPNewSessionInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -447,6 +453,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ConcurrencyControlConfig extends WebSecurityConfigurerAdapter {
@@ -473,6 +480,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ConcurrencyControlInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -503,6 +511,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class SessionCreationPolicyStateLessInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -519,6 +528,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -549,6 +559,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class SharedTrustResolverConfig extends WebSecurityConfigurerAdapter {
@@ -564,6 +575,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class SessionRegistryOneBeanConfig extends WebSecurityConfigurerAdapter {
@@ -585,6 +597,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class SessionRegistryTwoBeansConfig extends WebSecurityConfigurerAdapter {
@@ -613,6 +626,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultUrlRewriteConfig {
@@ -628,6 +642,7 @@ public class SessionManagementConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class EnableUrlRewriteConfig {

View File

@@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
@@ -63,6 +64,7 @@ public class SessionManagementConfigurerTransientAuthenticationTests {
assertThat(result.getRequest().getSession(false)).isNotNull();
}
@Configuration
@EnableWebSecurity
static class WithTransientAuthenticationConfig extends WebSecurityConfigurerAdapter {
@@ -85,6 +87,7 @@ public class SessionManagementConfigurerTransientAuthenticationTests {
}
@Configuration
@EnableWebSecurity
static class AlwaysCreateSessionConfig extends WithTransientAuthenticationConfig {

View File

@@ -268,6 +268,7 @@ public class UrlAuthorizationConfigurerTests {
}
@EnableWebSecurity
@Configuration
@EnableWebMvc
static class MultiMvcMatcherConfig {

View File

@@ -24,6 +24,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.vote.AffirmativeBased;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -129,6 +130,7 @@ public class UrlAuthorizationsTests {
return null;
}
@Configuration
@EnableWebSecurity
static class RoleConfig extends WebSecurityConfigurerAdapter {
@@ -148,6 +150,7 @@ public class UrlAuthorizationsTests {
}
@Configuration
@EnableWebSecurity
static class NoSpecificAccessDecisionManagerConfig extends WebSecurityConfigurerAdapter {

View File

@@ -26,6 +26,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.security.config.annotation.ObjectPostProcessor;
import org.springframework.security.config.annotation.SecurityContextChangedListenerConfig;
@@ -151,6 +152,7 @@ public class X509ConfigurerTests {
}
}
@Configuration
@EnableWebSecurity
static class ObjectPostProcessorConfig extends WebSecurityConfigurerAdapter {
@@ -180,6 +182,7 @@ public class X509ConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DuplicateDoesNotOverrideConfig extends WebSecurityConfigurerAdapter {
@@ -205,6 +208,7 @@ public class X509ConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultsInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -227,6 +231,7 @@ public class X509ConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class SubjectPrincipalRegexInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -252,6 +257,7 @@ public class X509ConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class UserDetailsServiceBeanConfig {
@@ -279,6 +285,7 @@ public class X509ConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class UserDetailsServiceAndBeanConfig {

View File

@@ -27,6 +27,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockHttpSession;
@@ -281,6 +282,7 @@ public class OAuth2ClientConfigurerTests {
}
@EnableWebSecurity
@Configuration
@EnableWebMvc
static class OAuth2ClientConfig extends WebSecurityConfigurerAdapter {
@@ -326,6 +328,7 @@ public class OAuth2ClientConfigurerTests {
}
@EnableWebSecurity
@Configuration
@EnableWebMvc
static class OAuth2ClientInLambdaConfig extends WebSecurityConfigurerAdapter {

View File

@@ -658,6 +658,7 @@ public class OAuth2LoginConfigurerTests {
};
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfig extends CommonWebSecurityConfigurerAdapter
implements ApplicationListener<AuthenticationSuccessEvent> {
@@ -682,6 +683,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigFormLogin extends CommonWebSecurityConfigurerAdapter {
@@ -702,6 +704,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginInLambdaConfig extends CommonLambdaWebSecurityConfigurerAdapter
implements ApplicationListener<AuthenticationSuccessEvent> {
@@ -728,6 +731,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigCustomWithConfigurer extends CommonWebSecurityConfigurerAdapter {
@@ -746,6 +750,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigCustomWithBeanRegistration extends CommonWebSecurityConfigurerAdapter {
@@ -770,6 +775,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigCustomUserServiceBeanRegistration extends WebSecurityConfigurerAdapter {
@@ -821,6 +827,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigLoginProcessingUrl extends CommonWebSecurityConfigurerAdapter {
@@ -838,6 +845,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigCustomAuthorizationRequestResolver extends CommonWebSecurityConfigurerAdapter {
@@ -860,6 +868,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigCustomAuthorizationRequestResolverInLambda
extends CommonLambdaWebSecurityConfigurerAdapter {
@@ -887,6 +896,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigCustomAuthorizationRedirectStrategy extends CommonWebSecurityConfigurerAdapter {
@@ -957,6 +967,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigAuthorizationCodeClientAndOtherClients extends CommonWebSecurityConfigurerAdapter {
@@ -974,6 +985,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigCustomLoginPage extends CommonWebSecurityConfigurerAdapter {
@@ -991,6 +1003,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigCustomLoginPageInLambda extends CommonLambdaWebSecurityConfigurerAdapter {
@@ -1010,6 +1023,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginConfigWithOidcLogoutSuccessHandler extends CommonWebSecurityConfigurerAdapter {
@@ -1037,6 +1051,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginWithHttpBasicConfig extends CommonWebSecurityConfigurerAdapter {
@@ -1055,6 +1070,7 @@ public class OAuth2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginWithXHREntryPointConfig extends CommonWebSecurityConfigurerAdapter {

View File

@@ -1437,6 +1437,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
}
@Configuration
@EnableWebSecurity
static class DefaultConfig extends WebSecurityConfigurerAdapter {
@@ -1455,6 +1456,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -1476,6 +1478,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class JwkSetUriConfig extends WebSecurityConfigurerAdapter {
@@ -1498,6 +1501,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class JwkSetUriInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -1525,6 +1529,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CsrfDisabledConfig extends WebSecurityConfigurerAdapter {
@@ -1548,6 +1553,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AnonymousDisabledConfig extends WebSecurityConfigurerAdapter {
@@ -1566,6 +1572,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
static class MethodSecurityConfig extends WebSecurityConfigurerAdapter {
@@ -1584,6 +1591,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class JwtlessConfig extends WebSecurityConfigurerAdapter {
@@ -1600,6 +1608,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RealmNameConfiguredOnEntryPoint extends WebSecurityConfigurerAdapter {
@@ -1624,6 +1633,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class RealmNameConfiguredOnAccessDeniedHandler extends WebSecurityConfigurerAdapter {
@@ -1648,6 +1658,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ExceptionHandlingAndResourceServerWithAccessDeniedHandlerConfig extends WebSecurityConfigurerAdapter {
@@ -1683,6 +1694,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class JwtAuthenticationConverterConfiguredOnDsl extends WebSecurityConfigurerAdapter {
@@ -1707,6 +1719,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomAuthorityMappingConfig extends WebSecurityConfigurerAdapter {
@@ -1732,6 +1745,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class BasicAndResourceServerConfig extends WebSecurityConfigurerAdapter {
@@ -1764,6 +1778,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class FormAndResourceServerConfig extends WebSecurityConfigurerAdapter {
@@ -1783,6 +1798,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OAuth2LoginAndResourceServerConfig extends WebSecurityConfigurerAdapter {
@@ -1808,6 +1824,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class JwtHalfConfiguredConfig extends WebSecurityConfigurerAdapter {
@@ -1825,6 +1842,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AlwaysSessionCreationConfig extends WebSecurityConfigurerAdapter {
@@ -1842,6 +1860,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AllowBearerTokenInRequestBodyConfig extends WebSecurityConfigurerAdapter {
@@ -1866,6 +1885,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AllowBearerTokenAsQueryParameterConfig extends WebSecurityConfigurerAdapter {
@@ -1890,6 +1910,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class MultipleBearerTokenResolverBeansConfig extends WebSecurityConfigurerAdapter {
@@ -1921,6 +1942,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomAuthenticationDetailsSource {
@@ -1953,6 +1975,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
}
@Configuration
@EnableWebSecurity
static class CustomJwtDecoderOnDsl extends WebSecurityConfigurerAdapter {
@@ -1977,6 +2000,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomJwtDecoderInLambdaOnDsl extends WebSecurityConfigurerAdapter {
@@ -2006,6 +2030,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomJwtDecoderAsBean extends WebSecurityConfigurerAdapter {
@@ -2028,6 +2053,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class JwtAuthenticationManagerConfig extends WebSecurityConfigurerAdapter {
@@ -2051,6 +2077,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultAndJwtAuthenticationManagerConfig extends WebSecurityConfigurerAdapter {
@@ -2084,6 +2111,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomJwtValidatorConfig extends WebSecurityConfigurerAdapter {
@@ -2108,6 +2136,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class UnexpiredJwtClockSkewConfig extends WebSecurityConfigurerAdapter {
@@ -2130,6 +2159,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ExpiredJwtClockSkewConfig extends WebSecurityConfigurerAdapter {
@@ -2149,6 +2179,7 @@ public class OAuth2ResourceServerConfigurerTests {
.jwt();
}
}
@Configuration
@EnableWebSecurity
static class SingleKeyConfig extends WebSecurityConfigurerAdapter {
byte[] spec = Base64.getDecoder().decode(
@@ -2180,6 +2211,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class CustomAuthenticationEventPublisher extends WebSecurityConfigurerAdapter {
@@ -2207,6 +2239,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OpaqueTokenConfig extends WebSecurityConfigurerAdapter {
@@ -2225,6 +2258,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OpaqueTokenInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -2246,6 +2280,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OpaqueTokenAuthenticationManagerConfig extends WebSecurityConfigurerAdapter {
@@ -2269,6 +2304,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OpaqueTokenAuthenticationManagerInLambdaConfig extends WebSecurityConfigurerAdapter {
@@ -2297,6 +2333,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class DefaultAndOpaqueTokenAuthenticationManagerConfig extends WebSecurityConfigurerAdapter {
@@ -2330,6 +2367,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OpaqueAndJwtConfig extends WebSecurityConfigurerAdapter {
@@ -2346,6 +2384,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class OpaqueTokenHalfConfiguredConfig extends WebSecurityConfigurerAdapter {
@@ -2364,6 +2403,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class MultipleIssuersConfig extends WebSecurityConfigurerAdapter {
@@ -2385,6 +2425,7 @@ public class OAuth2ResourceServerConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class AuthenticationManagerResolverPlusOtherConfig extends WebSecurityConfigurerAdapter {

View File

@@ -38,6 +38,7 @@ import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.convert.converter.Converter;
import org.springframework.http.MediaType;
@@ -411,6 +412,7 @@ public class Saml2LoginConfigurerTests {
};
}
@Configuration
@EnableWebSecurity
@EnableWebMvc
@Import(Saml2LoginConfigBeans.class)
@@ -426,6 +428,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class Saml2LoginConfigWithCustomAuthenticationManager extends WebSecurityConfigurerAdapter {
@@ -438,6 +441,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class Saml2LoginConfigWithDefaultAndCustomAuthenticationManager extends WebSecurityConfigurerAdapter {
@@ -456,6 +460,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class Saml2LoginConfigWithAuthenticationDefaultsWithPostProcessor extends WebSecurityConfigurerAdapter {
@@ -477,6 +482,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class CustomAuthenticationFailureHandler extends WebSecurityConfigurerAdapter {
@@ -492,6 +498,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class CustomAuthenticationRequestResolverBean {
@@ -522,6 +529,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class CustomAuthenticationRequestResolverDsl {
@@ -554,6 +562,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class CustomAuthenticationConverter extends WebSecurityConfigurerAdapter {
@@ -568,6 +577,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class CustomAuthenticationConverterBean {
@@ -589,6 +599,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class CustomAuthenticationRequestRepository {
@@ -610,6 +621,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class CustomLoginProcessingUrlDefaultAuthenticationConverter {
@@ -626,6 +638,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class CustomAuthenticationRequestUriCustomAuthenticationConverter {
@@ -650,6 +663,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class CustomLoginProcessingUrlCustomAuthenticationConverter {
@@ -669,6 +683,7 @@ public class Saml2LoginConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class CustomLoginProcessingUrlSaml2AuthenticationTokenConverterBean {

View File

@@ -36,6 +36,7 @@ import org.opensaml.xmlsec.signature.support.SignatureConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -436,6 +437,7 @@ public class Saml2LogoutConfigurerTests {
return new SamlQueryStringRequestPostProcessor();
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class Saml2LogoutDefaultsConfig {
@@ -461,6 +463,7 @@ public class Saml2LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class Saml2LogoutCsrfDisabledConfig {
@@ -487,6 +490,7 @@ public class Saml2LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class Saml2LogoutWithHttpGet {
@@ -518,6 +522,7 @@ public class Saml2LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class Saml2DefaultsWithObjectPostProcessorConfig {
@@ -542,6 +547,7 @@ public class Saml2LogoutConfigurerTests {
}
@Configuration
@EnableWebSecurity
@Import(Saml2LoginConfigBeans.class)
static class Saml2LogoutComponentsConfig {

View File

@@ -320,12 +320,14 @@ public class EnableWebFluxSecurityTests {
context.refresh();
}
@Configuration
@EnableWebFluxSecurity
@Import(ReactiveAuthenticationTestConfiguration.class)
static class Config {
}
@Configuration
@EnableWebFluxSecurity
static class CustomPasswordEncoderConfig {
@@ -342,6 +344,7 @@ public class EnableWebFluxSecurityTests {
}
@Configuration
@EnableWebFluxSecurity
static class MapReactiveUserDetailsServiceConfig {
@@ -358,6 +361,7 @@ public class EnableWebFluxSecurityTests {
}
@Configuration
@EnableWebFluxSecurity
@Import(ReactiveAuthenticationTestConfiguration.class)
static class MultiSecurityHttpConfig {
@@ -377,6 +381,7 @@ public class EnableWebFluxSecurityTests {
}
@Configuration
@EnableWebFluxSecurity
@EnableWebFlux
@Import(ReactiveAuthenticationTestConfiguration.class)
@@ -407,6 +412,7 @@ public class EnableWebFluxSecurityTests {
}
@Configuration
@EnableWebFluxSecurity
@Import(ReactiveAuthenticationTestConfiguration.class)
static class BeanProxyEnabledByDefaultConfig {

View File

@@ -23,6 +23,7 @@ import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.test.SpringTestContext;
import org.springframework.security.config.test.SpringTestContextExtension;
import org.springframework.security.config.web.server.ServerHttpSecurity;
@@ -125,6 +126,7 @@ public class ReactiveOAuth2ClientImportSelectorTest {
// @formatter:on
}
@Configuration
@EnableWebFlux
@EnableWebFluxSecurity
static class OAuth2AuthorizedClientManagerRegisteredConfig {

View File

@@ -77,6 +77,7 @@ public class AuthenticationConfigurationGh3935Tests {
assertThat(auth.getPrincipal()).isEqualTo(PasswordEncodedUser.user());
}
@Configuration
@EnableWebSecurity
static class WebSecurity extends WebSecurityConfigurerAdapter {

View File

@@ -140,6 +140,7 @@ public class RsaKeyConversionServicePostProcessorTests {
.withRootCauseInstanceOf(IllegalArgumentException.class);
}
@Configuration
@EnableWebSecurity
static class DefaultConfig {

View File

@@ -28,6 +28,7 @@ import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -109,6 +110,7 @@ public class CustomHttpSecurityConfigurerTests {
context.getAutowireCapableBeanFactory().autowireBean(this);
}
@Configuration
@EnableWebSecurity
static class Config extends WebSecurityConfigurerAdapter {
@@ -133,6 +135,7 @@ public class CustomHttpSecurityConfigurerTests {
}
@Configuration
@EnableWebSecurity
static class ConfigCustomize extends WebSecurityConfigurerAdapter {

View File

@@ -23,6 +23,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.test.SpringTestContext;
import org.springframework.security.config.test.SpringTestContextExtension;
@@ -152,6 +153,7 @@ public class HttpsRedirectSpecTests {
// @formatter:on
}
@Configuration
@EnableWebFlux
@EnableWebFluxSecurity
static class RedirectToHttpConfig {
@@ -167,6 +169,7 @@ public class HttpsRedirectSpecTests {
}
@Configuration
@EnableWebFlux
@EnableWebFluxSecurity
static class RedirectToHttpsInLambdaConfig {
@@ -182,6 +185,7 @@ public class HttpsRedirectSpecTests {
}
@Configuration
@EnableWebFlux
@EnableWebFluxSecurity
static class SometimesRedirectToHttpsConfig {
@@ -198,6 +202,7 @@ public class HttpsRedirectSpecTests {
}
@Configuration
@EnableWebFlux
@EnableWebFluxSecurity
static class SometimesRedirectToHttpsInLambdaConfig {
@@ -216,6 +221,7 @@ public class HttpsRedirectSpecTests {
}
@Configuration
@EnableWebFlux
@EnableWebFluxSecurity
static class RedirectToHttpsViaCustomPortsConfig {
@@ -237,6 +243,7 @@ public class HttpsRedirectSpecTests {
}
@Configuration
@EnableWebFlux
@EnableWebFluxSecurity
static class RedirectToHttpsViaCustomPortsInLambdaConfig {

Some files were not shown because too many files have changed in this diff Show More