From 342884e851e88d706c9fcab78805fd1a077f23b5 Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Fri, 9 Jul 2021 15:51:18 -0500 Subject: [PATCH] kotlin uses @ExtendWith(SpringTestContextExtension::class) cd config/src/test/kotlin rg 'SpringTestContext' -l | xargs sed -i '/^import org.junit.jupiter.api.Test/a import org.junit.jupiter.api.extension.ExtendWith' rg 'SpringTestContext' -l | xargs sed -i '/^import org.springframework.security.config.test.SpringTestContext/a import org.springframework.security.config.test.SpringTestContextExtension' rg 'SpringTestContext' -l | xargs sed -i '/^class .*/i @ExtendWith(SpringTestContextExtension::class)' --- .../security/config/web/server/AuthorizeExchangeDslTests.kt | 3 +++ .../security/config/web/server/ServerAnonymousDslTests.kt | 3 +++ .../security/config/web/server/ServerCacheControlDslTests.kt | 3 +++ .../config/web/server/ServerContentSecurityPolicyDslTests.kt | 3 +++ .../config/web/server/ServerContentTypeOptionsDslTests.kt | 3 +++ .../security/config/web/server/ServerCorsDslTests.kt | 3 +++ .../security/config/web/server/ServerCsrfDslTests.kt | 3 +++ .../config/web/server/ServerExceptionHandlingDslTests.kt | 3 +++ .../security/config/web/server/ServerFormLoginDslTests.kt | 3 +++ .../security/config/web/server/ServerFrameOptionsDslTests.kt | 3 +++ .../security/config/web/server/ServerHeadersDslTests.kt | 3 +++ .../security/config/web/server/ServerHttpBasicDslTests.kt | 3 +++ .../security/config/web/server/ServerHttpSecurityDslTests.kt | 3 +++ .../web/server/ServerHttpStrictTransportSecurityDslTests.kt | 3 +++ .../security/config/web/server/ServerHttpsRedirectDslTests.kt | 3 +++ .../security/config/web/server/ServerJwtDslTests.kt | 3 +++ .../security/config/web/server/ServerLogoutDslTests.kt | 3 +++ .../security/config/web/server/ServerOAuth2ClientDslTests.kt | 3 +++ .../security/config/web/server/ServerOAuth2LoginDslTests.kt | 3 +++ .../config/web/server/ServerOAuth2ResourceServerDslTests.kt | 3 +++ .../security/config/web/server/ServerOpaqueTokenDslTests.kt | 3 +++ .../config/web/server/ServerPasswordManagementDslTests.kt | 3 +++ .../config/web/server/ServerPermissionsPolicyDslTests.kt | 3 +++ .../security/config/web/server/ServerReferrerPolicyDslTests.kt | 3 +++ .../security/config/web/server/ServerRequestCacheDslTests.kt | 3 +++ .../security/config/web/server/ServerX509DslTests.kt | 3 +++ .../security/config/web/server/ServerXssProtectionDslTests.kt | 3 +++ .../security/config/web/servlet/AnonymousDslTests.kt | 3 +++ .../security/config/web/servlet/AuthorizeRequestsDslTests.kt | 3 +++ .../security/config/web/servlet/CorsDslTests.kt | 3 +++ .../security/config/web/servlet/CsrfDslTests.kt | 3 +++ .../security/config/web/servlet/ExceptionHandlingDslTests.kt | 3 +++ .../security/config/web/servlet/FormLoginDslTests.kt | 3 +++ .../security/config/web/servlet/HeadersDslTests.kt | 3 +++ .../security/config/web/servlet/HttpBasicDslTests.kt | 3 +++ .../security/config/web/servlet/HttpSecurityDslTests.kt | 3 +++ .../security/config/web/servlet/LogoutDslTests.kt | 3 +++ .../security/config/web/servlet/OAuth2ClientDslTests.kt | 3 +++ .../security/config/web/servlet/OAuth2LoginDslTests.kt | 3 +++ .../config/web/servlet/OAuth2ResourceServerDslTests.kt | 3 +++ .../security/config/web/servlet/PasswordManagementDslTests.kt | 3 +++ .../security/config/web/servlet/PortMapperDslTests.kt | 3 +++ .../security/config/web/servlet/RememberMeDslTests.kt | 2 ++ .../security/config/web/servlet/RequestCacheDslTests.kt | 3 +++ .../security/config/web/servlet/RequiresChannelDslTests.kt | 3 +++ .../security/config/web/servlet/Saml2DslTests.kt | 3 +++ .../security/config/web/servlet/SessionManagementDslTests.kt | 3 +++ .../security/config/web/servlet/X509DslTests.kt | 3 +++ .../config/web/servlet/headers/CacheControlDslTests.kt | 3 +++ .../web/servlet/headers/ContentSecurityPolicyDslTests.kt | 3 +++ .../config/web/servlet/headers/ContentTypeOptionsDslTests.kt | 3 +++ .../config/web/servlet/headers/FrameOptionsDslTests.kt | 3 +++ .../config/web/servlet/headers/HttpPublicKeyPinningDslTests.kt | 3 +++ .../web/servlet/headers/HttpStrictTransportSecurityDslTests.kt | 3 +++ .../config/web/servlet/headers/ReferrerPolicyDslTests.kt | 3 +++ .../config/web/servlet/headers/XssProtectionConfigDslTests.kt | 3 +++ .../servlet/oauth2/client/AuthorizationCodeGrantDslTests.kt | 3 +++ .../web/servlet/oauth2/login/AuthorizationEndpointDslTests.kt | 3 +++ .../web/servlet/oauth2/login/RedirectionEndpointDslTests.kt | 3 +++ .../config/web/servlet/oauth2/login/TokenEndpointDslTests.kt | 3 +++ .../web/servlet/oauth2/login/UserInfoEndpointDslTests.kt | 3 +++ .../config/web/servlet/oauth2/resourceserver/JwtDslTests.kt | 3 +++ .../web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt | 3 +++ .../config/web/servlet/session/SessionConcurrencyDslTests.kt | 3 +++ .../config/web/servlet/session/SessionFixationDslTests.kt | 3 +++ 65 files changed, 194 insertions(+) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/AuthorizeExchangeDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/AuthorizeExchangeDslTests.kt index c030da5eb7..fd840ebd93 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/AuthorizeExchangeDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/AuthorizeExchangeDslTests.kt @@ -17,6 +17,7 @@ package org.springframework.security.config.web.server import org.junit.jupiter.api.Test +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 @@ -24,6 +25,7 @@ import org.springframework.security.config.annotation.web.reactive.EnableWebFlux import org.springframework.security.core.userdetails.MapReactiveUserDetailsService import org.springframework.security.core.userdetails.User import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.test.web.reactive.server.WebTestClient import org.springframework.web.bind.annotation.RequestMapping @@ -36,6 +38,7 @@ import java.util.* * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class AuthorizeExchangeDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerAnonymousDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerAnonymousDslTests.kt index 0bf5ec5806..b226f6a466 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerAnonymousDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerAnonymousDslTests.kt @@ -18,6 +18,7 @@ package org.springframework.security.config.web.server import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +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 @@ -26,6 +27,7 @@ import org.springframework.security.config.annotation.web.reactive.EnableWebFlux import org.springframework.security.core.annotation.AuthenticationPrincipal import org.springframework.security.core.authority.SimpleGrantedAuthority import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.test.web.reactive.server.WebTestClient import org.springframework.test.web.reactive.server.expectBody @@ -39,6 +41,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerAnonymousDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCacheControlDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCacheControlDslTests.kt index 9edc7d4fac..e357ffb164 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCacheControlDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCacheControlDslTests.kt @@ -17,12 +17,14 @@ package org.springframework.security.config.web.server import org.junit.jupiter.api.Test +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.http.HttpHeaders import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.test.web.reactive.server.WebTestClient import org.springframework.web.reactive.config.EnableWebFlux @@ -32,6 +34,7 @@ import org.springframework.web.reactive.config.EnableWebFlux * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerCacheControlDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerContentSecurityPolicyDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerContentSecurityPolicyDslTests.kt index 8925ba938a..1d23f01bca 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerContentSecurityPolicyDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerContentSecurityPolicyDslTests.kt @@ -17,11 +17,13 @@ package org.springframework.security.config.web.server import org.junit.jupiter.api.Test +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.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.header.ContentSecurityPolicyServerHttpHeadersWriter import org.springframework.test.web.reactive.server.WebTestClient @@ -32,6 +34,7 @@ import org.springframework.web.reactive.config.EnableWebFlux * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerContentSecurityPolicyDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerContentTypeOptionsDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerContentTypeOptionsDslTests.kt index 43da2e4d46..5868eff75a 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerContentTypeOptionsDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerContentTypeOptionsDslTests.kt @@ -17,11 +17,13 @@ package org.springframework.security.config.web.server import org.junit.jupiter.api.Test +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.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.header.ContentTypeOptionsServerHttpHeadersWriter import org.springframework.test.web.reactive.server.WebTestClient @@ -32,6 +34,7 @@ import org.springframework.web.reactive.config.EnableWebFlux * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerContentTypeOptionsDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCorsDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCorsDslTests.kt index 84757bc749..9cbcfacb16 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCorsDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCorsDslTests.kt @@ -17,12 +17,14 @@ package org.springframework.security.config.web.server import org.junit.jupiter.api.Test +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.http.HttpHeaders import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.test.web.reactive.server.WebTestClient import org.springframework.web.cors.CorsConfiguration @@ -35,6 +37,7 @@ import org.springframework.web.reactive.config.EnableWebFlux * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerCorsDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCsrfDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCsrfDslTests.kt index 2863117c33..659d598b27 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCsrfDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerCsrfDslTests.kt @@ -20,12 +20,14 @@ import io.mockk.every import io.mockk.mockkObject import io.mockk.verify import org.junit.jupiter.api.Test +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.http.MediaType import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.authorization.ServerAccessDeniedHandler import org.springframework.security.web.server.csrf.CsrfToken @@ -45,6 +47,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerCsrfDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerExceptionHandlingDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerExceptionHandlingDslTests.kt index a58f4728f5..342bfd6c55 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerExceptionHandlingDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerExceptionHandlingDslTests.kt @@ -18,6 +18,7 @@ package org.springframework.security.config.web.server import org.assertj.core.api.Assertions import org.junit.jupiter.api.Test +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 @@ -26,6 +27,7 @@ import org.springframework.security.config.annotation.web.reactive.EnableWebFlux import org.springframework.security.core.userdetails.MapReactiveUserDetailsService import org.springframework.security.core.userdetails.User import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.authentication.RedirectServerAuthenticationEntryPoint import org.springframework.security.web.server.authorization.HttpStatusServerAccessDeniedHandler @@ -38,6 +40,7 @@ import java.util.* * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerExceptionHandlingDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerFormLoginDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerFormLoginDslTests.kt index 1076c81805..8750440412 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerFormLoginDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerFormLoginDslTests.kt @@ -20,6 +20,7 @@ import io.mockk.mockkObject import io.mockk.verify import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +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 @@ -28,6 +29,7 @@ import org.springframework.http.HttpMethod import org.springframework.security.authentication.ReactiveAuthenticationManager import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.userdetails.MapReactiveUserDetailsService import org.springframework.security.core.userdetails.User import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf @@ -50,6 +52,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerFormLoginDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerFrameOptionsDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerFrameOptionsDslTests.kt index 35a50c6137..000cd1f0bd 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerFrameOptionsDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerFrameOptionsDslTests.kt @@ -17,11 +17,13 @@ package org.springframework.security.config.web.server import org.junit.jupiter.api.Test +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.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.header.writers.frameoptions.XFrameOptionsHeaderWriter import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.header.XFrameOptionsServerHttpHeadersWriter @@ -33,6 +35,7 @@ import org.springframework.web.reactive.config.EnableWebFlux * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerFrameOptionsDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHeadersDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHeadersDslTests.kt index 7f9466a6f5..3c404e2807 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHeadersDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHeadersDslTests.kt @@ -17,12 +17,14 @@ package org.springframework.security.config.web.server import org.junit.jupiter.api.Test +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.http.HttpHeaders import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.header.writers.frameoptions.XFrameOptionsHeaderWriter import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.header.ContentTypeOptionsServerHttpHeadersWriter @@ -37,6 +39,7 @@ import org.springframework.web.reactive.config.EnableWebFlux * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerHeadersDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpBasicDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpBasicDslTests.kt index 157e2e5c6a..52a3fe3ec9 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpBasicDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpBasicDslTests.kt @@ -21,6 +21,7 @@ import io.mockk.mockkObject import io.mockk.verify import java.util.Base64 import org.junit.jupiter.api.Test +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 @@ -29,6 +30,7 @@ import org.springframework.security.authentication.ReactiveAuthenticationManager import org.springframework.security.authentication.TestingAuthenticationToken import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.Authentication import org.springframework.security.core.userdetails.MapReactiveUserDetailsService import org.springframework.security.core.userdetails.User @@ -47,6 +49,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerHttpBasicDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpSecurityDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpSecurityDslTests.kt index 4632ab27be..eaebb5643e 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpSecurityDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpSecurityDslTests.kt @@ -21,6 +21,7 @@ import io.mockk.mockkObject import io.mockk.verify import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +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 @@ -29,6 +30,7 @@ import org.springframework.security.authentication.ReactiveAuthenticationManager import org.springframework.security.authentication.TestingAuthenticationToken import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.header.writers.frameoptions.XFrameOptionsHeaderWriter import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter @@ -49,6 +51,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerHttpSecurityDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpStrictTransportSecurityDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpStrictTransportSecurityDslTests.kt index 5257caa207..67fcbf3de1 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpStrictTransportSecurityDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpStrictTransportSecurityDslTests.kt @@ -17,12 +17,14 @@ package org.springframework.security.config.web.server.headers import org.junit.jupiter.api.Test +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.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.web.server.invoke import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.config.web.server.ServerHttpSecurity import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.header.StrictTransportSecurityServerHttpHeadersWriter @@ -35,6 +37,7 @@ import java.time.Duration * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerHttpStrictTransportSecurityDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpsRedirectDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpsRedirectDslTests.kt index 6108360649..06cd81e27a 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpsRedirectDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerHttpsRedirectDslTests.kt @@ -18,11 +18,13 @@ package org.springframework.security.config.web.server import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +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.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.PortMapperImpl import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.util.matcher.PathPatternParserServerWebExchangeMatcher @@ -35,6 +37,7 @@ import java.util.* * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerHttpsRedirectDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerJwtDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerJwtDslTests.kt index bf007a1a53..52b92a041f 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerJwtDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerJwtDslTests.kt @@ -28,6 +28,7 @@ import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +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 @@ -37,6 +38,7 @@ import org.springframework.security.authentication.AbstractAuthenticationToken import org.springframework.security.authentication.TestingAuthenticationToken import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.oauth2.core.oidc.IdTokenClaimNames import org.springframework.security.oauth2.jwt.Jwt import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder @@ -52,6 +54,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerJwtDslTests { private val expired = "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE1MzUwMzc4OTd9.jqZDDjfc2eysX44lHXEIr9XFd2S8vjIZHCccZU-dRWMRJNsQ1QN5VNnJGklqJBXJR4qgla6cmVqPOLkUHDb0sL0nxM5XuzQaG5ZzKP81RV88shFyAiT0fD-6nl1k-Fai-Fu-VkzSpNXgeONoTxDaYhdB-yxmgrgsApgmbOTE_9AcMk-FQDXQ-pL9kynccFGV0lZx4CA7cyknKN7KBxUilfIycvXODwgKCjj_1WddLTCNGYogJJSg__7NoxzqbyWd3udbHVjqYq7GsMMrGB4_2kBD4CkghOSNcRHbT_DIXowxfAVT7PAg7Q0E5ruZsr2zPZacEUDhJ6-wbvlA0FAOUg" diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerLogoutDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerLogoutDslTests.kt index 4c7cf5324b..705e943c25 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerLogoutDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerLogoutDslTests.kt @@ -21,11 +21,13 @@ import io.mockk.mockkObject import io.mockk.verify import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +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.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.authentication.logout.ServerLogoutHandler @@ -40,6 +42,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerLogoutDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2ClientDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2ClientDslTests.kt index 450dc96ca7..a49eea05e4 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2ClientDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2ClientDslTests.kt @@ -20,6 +20,7 @@ import io.mockk.every import io.mockk.mockkObject import io.mockk.verify import org.junit.jupiter.api.Test +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 @@ -29,6 +30,7 @@ import org.springframework.security.authentication.TestingAuthenticationToken import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.oauth2.client.CommonOAuth2Provider import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.oauth2.client.registration.InMemoryReactiveClientRegistrationRepository import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository import org.springframework.security.oauth2.client.web.server.ServerAuthorizationRequestRepository @@ -46,6 +48,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerOAuth2ClientDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2LoginDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2LoginDslTests.kt index b6fd1fd396..39b3c5d7dc 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2LoginDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2LoginDslTests.kt @@ -20,6 +20,7 @@ import io.mockk.every import io.mockk.mockkObject import io.mockk.verify import org.junit.jupiter.api.Test +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 @@ -27,6 +28,7 @@ import org.springframework.context.annotation.Configuration import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.oauth2.client.CommonOAuth2Provider import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.oauth2.client.registration.InMemoryReactiveClientRegistrationRepository import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository import org.springframework.security.oauth2.client.web.server.ServerAuthorizationRequestRepository @@ -44,6 +46,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerOAuth2LoginDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2ResourceServerDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2ResourceServerDslTests.kt index ba81f305bf..275b28244c 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2ResourceServerDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOAuth2ResourceServerDslTests.kt @@ -24,6 +24,7 @@ import java.security.KeyFactory import java.security.interfaces.RSAPublicKey import java.security.spec.RSAPublicKeySpec import org.junit.jupiter.api.Test +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 @@ -31,6 +32,7 @@ import org.springframework.http.HttpStatus import org.springframework.security.authentication.ReactiveAuthenticationManagerResolver import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.oauth2.server.resource.web.server.ServerBearerTokenAuthenticationConverter import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.authentication.HttpStatusServerEntryPoint @@ -45,6 +47,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerOAuth2ResourceServerDslTests { private val validJwt = "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJtb2NrLXN1YmplY3QiLCJzY29wZSI6Im1lc3NhZ2U6cmVhZCIsImV4cCI6NDY4ODY0MTQxM30.cRl1bv_dDYcAN5U4NlIVKj8uu4mLMwjABF93P4dShiq-GQ-owzaqTSlB4YarNFgV3PKQvT9wxN1jBpGribvISljakoC0E8wDV-saDi8WxN-qvImYsn1zLzYFiZXCfRIxCmonJpydeiAPRxMTPtwnYDS9Ib0T_iA80TBGd-INhyxUUfrwRW5sqKRbjUciRJhpp7fW2ZYXmi9iPt3HDjRQA4IloJZ7f4-spt5Q9wl5HcQTv1t4XrX4eqhVbE5cCoIkFQnKPOc-jhVM44_eazLU6Xk-CCXP8C_UT5pX0luRS2cJrVFfHp2IR_AWxC-shItg6LNEmNFD4Zc-JLZcr0Q86Q" diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOpaqueTokenDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOpaqueTokenDslTests.kt index 3547146724..c201df9334 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOpaqueTokenDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerOpaqueTokenDslTests.kt @@ -20,12 +20,14 @@ import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +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.http.HttpHeaders import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.oauth2.server.resource.introspection.NimbusReactiveOpaqueTokenIntrospector import org.springframework.security.oauth2.server.resource.introspection.ReactiveOpaqueTokenIntrospector import org.springframework.security.web.server.SecurityWebFilterChain @@ -38,6 +40,7 @@ import javax.annotation.PreDestroy * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerOpaqueTokenDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerPasswordManagementDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerPasswordManagementDslTests.kt index 500f161659..47253f11f8 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerPasswordManagementDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerPasswordManagementDslTests.kt @@ -18,11 +18,13 @@ package org.springframework.security.config.web.server import org.apache.http.HttpHeaders import org.junit.jupiter.api.Test +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.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.test.web.reactive.server.WebTestClient import org.springframework.web.reactive.config.EnableWebFlux @@ -32,6 +34,7 @@ import org.springframework.web.reactive.config.EnableWebFlux * * @author Evgeniy Cheban */ +@ExtendWith(SpringTestContextExtension::class) class ServerPasswordManagementDslTests { @JvmField diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerPermissionsPolicyDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerPermissionsPolicyDslTests.kt index 0b32cb8ab4..94e2acaa39 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerPermissionsPolicyDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerPermissionsPolicyDslTests.kt @@ -17,11 +17,13 @@ package org.springframework.security.config.web.server import org.junit.jupiter.api.Test +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.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.test.web.reactive.server.WebTestClient import org.springframework.web.reactive.config.EnableWebFlux @@ -31,6 +33,7 @@ import org.springframework.web.reactive.config.EnableWebFlux * * @author Christophe Gilles */ +@ExtendWith(SpringTestContextExtension::class) class ServerPermissionsPolicyDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerReferrerPolicyDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerReferrerPolicyDslTests.kt index b50abf820b..48beb5f7bc 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerReferrerPolicyDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerReferrerPolicyDslTests.kt @@ -17,11 +17,13 @@ package org.springframework.security.config.web.server import org.junit.jupiter.api.Test +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.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.header.writers.ReferrerPolicyHeaderWriter import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.header.ReferrerPolicyServerHttpHeadersWriter @@ -33,6 +35,7 @@ import org.springframework.web.reactive.config.EnableWebFlux * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerReferrerPolicyDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerRequestCacheDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerRequestCacheDslTests.kt index 640363101c..ec84655a2b 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerRequestCacheDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerRequestCacheDslTests.kt @@ -20,12 +20,14 @@ import io.mockk.every import io.mockk.mockkObject import io.mockk.verify import org.junit.jupiter.api.Test +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 import org.springframework.security.core.userdetails.MapReactiveUserDetailsService import org.springframework.security.core.userdetails.User import org.springframework.security.web.server.SecurityWebFilterChain @@ -40,6 +42,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerRequestCacheDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerX509DslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerX509DslTests.kt index 37b345d852..2afde56cad 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerX509DslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerX509DslTests.kt @@ -22,6 +22,7 @@ import java.security.cert.Certificate import java.security.cert.CertificateFactory import java.security.cert.X509Certificate import org.junit.jupiter.api.Test +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 @@ -33,6 +34,7 @@ import org.springframework.http.server.reactive.SslInfo import org.springframework.lang.Nullable import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.annotation.AuthenticationPrincipal import org.springframework.security.core.userdetails.MapReactiveUserDetailsService import org.springframework.security.core.userdetails.User @@ -58,6 +60,7 @@ import reactor.core.publisher.Mono * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerX509DslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerXssProtectionDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerXssProtectionDslTests.kt index 2a405fcd54..5816fb6aea 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/server/ServerXssProtectionDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/server/ServerXssProtectionDslTests.kt @@ -17,11 +17,13 @@ package org.springframework.security.config.web.server import org.junit.jupiter.api.Test +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.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.SecurityWebFilterChain import org.springframework.security.web.server.header.XXssProtectionServerHttpHeadersWriter import org.springframework.test.web.reactive.server.WebTestClient @@ -32,6 +34,7 @@ import org.springframework.web.reactive.config.EnableWebFlux * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ServerXssProtectionDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/AnonymousDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/AnonymousDslTests.kt index b6b1b5c99b..754a9d91ff 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/AnonymousDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/AnonymousDslTests.kt @@ -17,12 +17,14 @@ package org.springframework.security.config.web.servlet import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.security.authentication.AnonymousAuthenticationToken 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.annotation.AuthenticationPrincipal import org.springframework.security.core.authority.SimpleGrantedAuthority import org.springframework.security.core.context.SecurityContextHolder @@ -38,6 +40,7 @@ import java.util.* * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class AnonymousDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/AuthorizeRequestsDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/AuthorizeRequestsDslTests.kt index 45cb658d09..279d78b359 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/AuthorizeRequestsDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/AuthorizeRequestsDslTests.kt @@ -17,6 +17,7 @@ package org.springframework.security.config.web.servlet 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.Bean import org.springframework.context.annotation.Configuration @@ -25,6 +26,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.userdetails.User import org.springframework.security.core.userdetails.UserDetailsService import org.springframework.security.provisioning.InMemoryUserDetailsManager @@ -50,6 +52,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class AuthorizeRequestsDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/CorsDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/CorsDslTests.kt index b33f6ac164..bd33989bb7 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/CorsDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/CorsDslTests.kt @@ -18,6 +18,7 @@ package org.springframework.security.config.web.servlet import org.assertj.core.api.Assertions.assertThatThrownBy import org.junit.jupiter.api.Test +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 @@ -26,6 +27,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.test.web.servlet.MockMvc import org.springframework.test.web.servlet.get import org.springframework.web.bind.annotation.RequestMethod @@ -39,6 +41,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class CorsDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/CsrfDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/CsrfDslTests.kt index 67632ffd7d..19b885e29b 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/CsrfDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/CsrfDslTests.kt @@ -20,12 +20,14 @@ import io.mockk.every import io.mockk.mockkObject import io.mockk.verify 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.Bean 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.userdetails.User import org.springframework.security.core.userdetails.UserDetailsService import org.springframework.security.provisioning.InMemoryUserDetailsManager @@ -47,6 +49,7 @@ import org.springframework.web.bind.annotation.RestController * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class CsrfDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/ExceptionHandlingDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/ExceptionHandlingDslTests.kt index d035747a20..43a525148f 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/ExceptionHandlingDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/ExceptionHandlingDslTests.kt @@ -18,12 +18,14 @@ package org.springframework.security.config.web.servlet import org.assertj.core.api.Assertions.assertThatExceptionOfType import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.security.access.AccessDeniedException 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.userdetails.User.withUsername import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user import org.springframework.security.web.access.AccessDeniedHandlerImpl @@ -38,6 +40,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ExceptionHandlingDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/FormLoginDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/FormLoginDslTests.kt index ea948d0179..5af6f0a3e7 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/FormLoginDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/FormLoginDslTests.kt @@ -17,6 +17,7 @@ package org.springframework.security.config.web.servlet 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 @@ -24,6 +25,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.userdetails.User import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestBuilders.formLogin import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler @@ -40,6 +42,7 @@ import org.springframework.web.bind.annotation.GetMapping * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class FormLoginDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/HeadersDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/HeadersDslTests.kt index 6e10121ab5..c2cbfb371d 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/HeadersDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/HeadersDslTests.kt @@ -17,12 +17,14 @@ package org.springframework.security.config.web.servlet import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.http.HttpHeaders 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.config.web.servlet.headers.PermissionsPolicyDsl import org.springframework.security.web.header.writers.StaticHeadersWriter import org.springframework.security.web.header.writers.frameoptions.XFrameOptionsHeaderWriter @@ -38,6 +40,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class HeadersDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/HttpBasicDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/HttpBasicDslTests.kt index f9af2e6577..cb6f6b47f8 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/HttpBasicDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/HttpBasicDslTests.kt @@ -21,6 +21,7 @@ import io.mockk.mockkObject import io.mockk.verify import javax.servlet.http.HttpServletRequest 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.Bean import org.springframework.context.annotation.Configuration @@ -29,6 +30,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.userdetails.User import org.springframework.security.core.userdetails.UserDetailsService import org.springframework.security.provisioning.InMemoryUserDetailsManager @@ -44,6 +46,7 @@ import org.springframework.web.bind.annotation.RestController * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class HttpBasicDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/HttpSecurityDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/HttpSecurityDslTests.kt index 7bb9ce4f02..eea2c3bff1 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/HttpSecurityDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/HttpSecurityDslTests.kt @@ -21,6 +21,7 @@ import io.mockk.mockkObject import io.mockk.verify import org.assertj.core.api.Assertions.assertThat 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.Bean import org.springframework.context.annotation.Configuration @@ -33,6 +34,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.userdetails.User import org.springframework.security.core.userdetails.UserDetailsService import org.springframework.security.provisioning.InMemoryUserDetailsManager @@ -57,6 +59,7 @@ import javax.servlet.Filter * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class HttpSecurityDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/LogoutDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/LogoutDslTests.kt index e996d8f073..2bf1af5471 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/LogoutDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/LogoutDslTests.kt @@ -21,6 +21,7 @@ import io.mockk.mockkObject import io.mockk.verify import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.mock.web.MockHttpSession import org.springframework.security.authentication.TestingAuthenticationToken @@ -28,6 +29,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.context.SecurityContextHolder import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf import org.springframework.security.web.authentication.logout.LogoutHandler @@ -42,6 +44,7 @@ import org.springframework.test.web.servlet.post * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class LogoutDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2ClientDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2ClientDslTests.kt index e217ef4d82..ba45eb97cb 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2ClientDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2ClientDslTests.kt @@ -20,6 +20,7 @@ import io.mockk.every import io.mockk.mockkObject import io.mockk.verify 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.Bean import org.springframework.context.annotation.Configuration @@ -28,6 +29,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter import org.springframework.security.config.oauth2.client.CommonOAuth2Provider import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository @@ -48,6 +50,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class OAuth2ClientDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2LoginDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2LoginDslTests.kt index d44bbd6d99..9521b4ccd8 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2LoginDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2LoginDslTests.kt @@ -17,6 +17,7 @@ package org.springframework.security.config.web.servlet 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.Bean import org.springframework.context.annotation.Configuration @@ -25,6 +26,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter import org.springframework.security.config.oauth2.client.CommonOAuth2Provider import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository import org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository import org.springframework.test.web.servlet.MockMvc @@ -37,6 +39,7 @@ import org.springframework.web.bind.annotation.RestController * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class OAuth2LoginDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2ResourceServerDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2ResourceServerDslTests.kt index 752668c087..72b0fae55e 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2ResourceServerDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2ResourceServerDslTests.kt @@ -23,6 +23,7 @@ import io.mockk.verify import javax.servlet.http.HttpServletRequest import org.assertj.core.api.Assertions import org.junit.jupiter.api.Test +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 @@ -33,6 +34,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.oauth2.core.oidc.IdTokenClaimNames.SUB import org.springframework.security.oauth2.jwt.Jwt import org.springframework.security.oauth2.jwt.JwtDecoder @@ -49,6 +51,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class OAuth2ResourceServerDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/PasswordManagementDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/PasswordManagementDslTests.kt index f21044d8db..af302cf96f 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/PasswordManagementDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/PasswordManagementDslTests.kt @@ -17,11 +17,13 @@ package org.springframework.security.config.web.servlet import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.test.web.servlet.MockMvc import org.springframework.test.web.servlet.get @@ -30,6 +32,7 @@ import org.springframework.test.web.servlet.get * * @author Evgeniy Cheban */ +@ExtendWith(SpringTestContextExtension::class) class PasswordManagementDslTests { @JvmField diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/PortMapperDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/PortMapperDslTests.kt index c810271ffc..7f020208c8 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/PortMapperDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/PortMapperDslTests.kt @@ -17,11 +17,13 @@ package org.springframework.security.config.web.servlet import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.PortMapperImpl import org.springframework.test.web.servlet.MockMvc import org.springframework.test.web.servlet.get @@ -32,6 +34,7 @@ import java.util.* * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class PortMapperDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/RememberMeDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/RememberMeDslTests.kt index cfeb2d1454..17efacf3a4 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/RememberMeDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/RememberMeDslTests.kt @@ -26,6 +26,7 @@ import io.mockk.verify import javax.servlet.http.HttpServletRequest import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.api.fail import org.springframework.beans.factory.annotation.Autowired import org.springframework.context.annotation.Bean @@ -38,6 +39,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.Authentication import org.springframework.security.core.authority.AuthorityUtils import org.springframework.security.core.userdetails.PasswordEncodedUser diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/RequestCacheDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/RequestCacheDslTests.kt index 2a983ae11c..52ee0492e5 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/RequestCacheDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/RequestCacheDslTests.kt @@ -17,11 +17,13 @@ package org.springframework.security.config.web.servlet import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestBuilders.formLogin import org.springframework.security.web.savedrequest.NullRequestCache import org.springframework.test.web.servlet.MockMvc @@ -33,6 +35,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirec * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class RequestCacheDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/RequiresChannelDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/RequiresChannelDslTests.kt index fd9e6fd3e5..3ec020307b 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/RequiresChannelDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/RequiresChannelDslTests.kt @@ -19,12 +19,14 @@ package org.springframework.security.config.web.servlet import io.mockk.mockkObject import io.mockk.verify import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.security.access.ConfigAttribute 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.FilterInvocation import org.springframework.security.web.access.channel.ChannelProcessor import org.springframework.test.web.servlet.MockMvc @@ -42,6 +44,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class RequiresChannelDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/Saml2DslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/Saml2DslTests.kt index 5115badbc9..a9dc47a2da 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/Saml2DslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/Saml2DslTests.kt @@ -22,6 +22,7 @@ import io.mockk.mockkObject import io.mockk.verify import org.assertj.core.api.Assertions import org.junit.jupiter.api.Test +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 @@ -33,6 +34,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.saml2.credentials.Saml2X509Credential import org.springframework.security.saml2.credentials.Saml2X509Credential.Saml2X509CredentialType.VERIFICATION import org.springframework.security.saml2.provider.service.registration.InMemoryRelyingPartyRegistrationRepository @@ -52,6 +54,7 @@ import java.util.Base64 * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class Saml2DslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/SessionManagementDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/SessionManagementDslTests.kt index 7c42bc1d2c..25302355ea 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/SessionManagementDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/SessionManagementDslTests.kt @@ -23,6 +23,7 @@ import io.mockk.mockkObject import io.mockk.verify import org.assertj.core.api.Assertions.assertThat 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.Bean import org.springframework.mock.web.MockHttpSession @@ -31,6 +32,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter import org.springframework.security.config.http.SessionCreationPolicy import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.Authentication import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.authentication import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler @@ -47,6 +49,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class SessionManagementDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/X509DslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/X509DslTests.kt index 9507930c4d..e0f6577f14 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/X509DslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/X509DslTests.kt @@ -21,6 +21,7 @@ import java.security.cert.Certificate import java.security.cert.CertificateFactory import java.security.cert.X509Certificate 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.Bean import org.springframework.core.io.ClassPathResource @@ -28,6 +29,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.core.userdetails.User import org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper import org.springframework.security.core.userdetails.UserDetailsService @@ -44,6 +46,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class X509DslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/CacheControlDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/CacheControlDslTests.kt index 31fa7a57ef..ab2782ac43 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/CacheControlDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/CacheControlDslTests.kt @@ -17,6 +17,7 @@ package org.springframework.security.config.web.servlet.headers import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired import org.springframework.http.HttpHeaders import org.springframework.security.config.annotation.web.builders.HttpSecurity @@ -24,6 +25,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter import org.springframework.security.config.web.servlet.invoke import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.test.web.servlet.MockMvc import org.springframework.test.web.servlet.get @@ -32,6 +34,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class CacheControlDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ContentSecurityPolicyDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ContentSecurityPolicyDslTests.kt index da0d88c020..b312311cd6 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ContentSecurityPolicyDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ContentSecurityPolicyDslTests.kt @@ -17,12 +17,14 @@ package org.springframework.security.config.web.servlet.headers import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired 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 import org.springframework.security.config.web.servlet.invoke import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.header.ContentSecurityPolicyServerHttpHeadersWriter import org.springframework.test.web.servlet.MockMvc import org.springframework.test.web.servlet.get @@ -32,6 +34,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ContentSecurityPolicyDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ContentTypeOptionsDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ContentTypeOptionsDslTests.kt index 51f200cd6a..ce682ed76d 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ContentTypeOptionsDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ContentTypeOptionsDslTests.kt @@ -17,12 +17,14 @@ package org.springframework.security.config.web.servlet.headers import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired 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 import org.springframework.security.config.web.servlet.invoke import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.header.ContentTypeOptionsServerHttpHeadersWriter import org.springframework.test.web.servlet.MockMvc import org.springframework.test.web.servlet.get @@ -32,6 +34,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ContentTypeOptionsDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/FrameOptionsDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/FrameOptionsDslTests.kt index 228a8f1d99..021dda0848 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/FrameOptionsDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/FrameOptionsDslTests.kt @@ -17,12 +17,14 @@ package org.springframework.security.config.web.servlet.headers import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired 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 import org.springframework.security.config.web.servlet.invoke import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.header.writers.frameoptions.XFrameOptionsHeaderWriter import org.springframework.security.web.server.header.XFrameOptionsServerHttpHeadersWriter import org.springframework.test.web.servlet.MockMvc @@ -33,6 +35,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class FrameOptionsDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/HttpPublicKeyPinningDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/HttpPublicKeyPinningDslTests.kt index 0722d30703..e4759fb284 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/HttpPublicKeyPinningDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/HttpPublicKeyPinningDslTests.kt @@ -18,11 +18,13 @@ package org.springframework.security.config.web.servlet.headers import org.assertj.core.api.Assertions import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.config.web.servlet.invoke import org.springframework.test.web.servlet.MockMvc import org.springframework.test.web.servlet.get @@ -32,6 +34,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class HttpPublicKeyPinningDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/HttpStrictTransportSecurityDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/HttpStrictTransportSecurityDslTests.kt index ed1f6875e7..374eb607c3 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/HttpStrictTransportSecurityDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/HttpStrictTransportSecurityDslTests.kt @@ -18,12 +18,14 @@ package org.springframework.security.config.web.servlet.headers import org.assertj.core.api.Assertions import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired 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 import org.springframework.security.config.web.servlet.invoke import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.header.StrictTransportSecurityServerHttpHeadersWriter import org.springframework.security.web.util.matcher.AntPathRequestMatcher import org.springframework.test.web.servlet.MockMvc @@ -34,6 +36,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class HttpStrictTransportSecurityDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ReferrerPolicyDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ReferrerPolicyDslTests.kt index 4f23fcf1ba..c9d3c04d06 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ReferrerPolicyDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/ReferrerPolicyDslTests.kt @@ -17,12 +17,14 @@ package org.springframework.security.config.web.servlet.headers import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired 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 import org.springframework.security.config.web.servlet.invoke import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.header.writers.ReferrerPolicyHeaderWriter import org.springframework.test.web.servlet.MockMvc import org.springframework.test.web.servlet.get @@ -32,6 +34,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class ReferrerPolicyDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/XssProtectionConfigDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/XssProtectionConfigDslTests.kt index 6f72fc0b2c..8b10f28cce 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/XssProtectionConfigDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/headers/XssProtectionConfigDslTests.kt @@ -17,12 +17,14 @@ package org.springframework.security.config.web.servlet.headers import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith import org.springframework.beans.factory.annotation.Autowired 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 import org.springframework.security.config.web.servlet.invoke import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.web.server.header.XXssProtectionServerHttpHeadersWriter import org.springframework.test.web.servlet.MockMvc import org.springframework.test.web.servlet.get @@ -32,6 +34,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class XssProtectionConfigDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/client/AuthorizationCodeGrantDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/client/AuthorizationCodeGrantDslTests.kt index e4e7bc899d..72e5db552e 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/client/AuthorizationCodeGrantDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/client/AuthorizationCodeGrantDslTests.kt @@ -21,6 +21,7 @@ import io.mockk.mockk import io.mockk.mockkObject import io.mockk.verify 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.Bean import org.springframework.context.annotation.Configuration @@ -29,6 +30,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter import org.springframework.security.config.oauth2.client.CommonOAuth2Provider import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.config.web.servlet.invoke import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest @@ -49,6 +51,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class AuthorizationCodeGrantDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/AuthorizationEndpointDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/AuthorizationEndpointDslTests.kt index d5149038c6..c4dff79baf 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/AuthorizationEndpointDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/AuthorizationEndpointDslTests.kt @@ -21,6 +21,7 @@ import io.mockk.mockkObject import io.mockk.verify import javax.servlet.http.HttpServletRequest 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.Bean import org.springframework.context.annotation.Configuration @@ -29,6 +30,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter import org.springframework.security.config.oauth2.client.CommonOAuth2Provider import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.config.web.servlet.invoke import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository import org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository @@ -44,6 +46,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class AuthorizationEndpointDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/RedirectionEndpointDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/RedirectionEndpointDslTests.kt index f754f9748b..9487e857ec 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/RedirectionEndpointDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/RedirectionEndpointDslTests.kt @@ -19,6 +19,7 @@ package org.springframework.security.config.web.servlet.oauth2.login import io.mockk.every import io.mockk.mockkObject 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.Bean import org.springframework.context.annotation.Configuration @@ -27,6 +28,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter import org.springframework.security.config.oauth2.client.CommonOAuth2Provider import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.config.web.servlet.invoke import org.springframework.security.core.authority.SimpleGrantedAuthority import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient @@ -52,6 +54,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class RedirectionEndpointDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/TokenEndpointDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/TokenEndpointDslTests.kt index f5d04a3241..9dc1df0cb5 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/TokenEndpointDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/TokenEndpointDslTests.kt @@ -20,6 +20,7 @@ import io.mockk.every import io.mockk.mockkObject import io.mockk.verify 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.Bean import org.springframework.context.annotation.Configuration @@ -28,6 +29,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter import org.springframework.security.config.oauth2.client.CommonOAuth2Provider import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.config.web.servlet.invoke import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient import org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest @@ -47,6 +49,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class TokenEndpointDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/UserInfoEndpointDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/UserInfoEndpointDslTests.kt index 852581b9d6..477504ec5c 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/UserInfoEndpointDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/login/UserInfoEndpointDslTests.kt @@ -21,6 +21,7 @@ import io.mockk.mockk import io.mockk.mockkObject import io.mockk.verify 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.Bean import org.springframework.context.annotation.Configuration @@ -29,6 +30,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter import org.springframework.security.config.oauth2.client.CommonOAuth2Provider import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.config.web.servlet.invoke import org.springframework.security.core.authority.SimpleGrantedAuthority import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient @@ -52,6 +54,7 @@ import org.springframework.test.web.servlet.get * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class UserInfoEndpointDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/JwtDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/JwtDslTests.kt index 957d9f217a..b0d92a53bd 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/JwtDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/JwtDslTests.kt @@ -21,6 +21,7 @@ import io.mockk.mockk import io.mockk.mockkObject import io.mockk.verify 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.Bean import org.springframework.core.convert.converter.Converter @@ -33,6 +34,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.config.web.servlet.invoke import org.springframework.security.core.Authentication import org.springframework.security.oauth2.core.oidc.IdTokenClaimNames @@ -49,6 +51,7 @@ import org.springframework.web.bind.annotation.RestController * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class JwtDslTests { private val jwtAuthenticationToken: Authentication = JwtAuthenticationToken( diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt index fb1c82e4e8..218e0618b9 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt @@ -20,6 +20,7 @@ import io.mockk.every import io.mockk.mockkObject import io.mockk.verify 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.Bean import org.springframework.http.HttpHeaders @@ -33,6 +34,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.config.web.servlet.invoke import org.springframework.security.core.Authentication import org.springframework.security.oauth2.core.DefaultOAuth2AuthenticatedPrincipal @@ -53,6 +55,7 @@ import org.springframework.web.client.RestTemplate * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class OpaqueTokenDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/session/SessionConcurrencyDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/session/SessionConcurrencyDslTests.kt index 0db92ca651..f35ca1284f 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/session/SessionConcurrencyDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/session/SessionConcurrencyDslTests.kt @@ -20,6 +20,7 @@ import io.mockk.every import io.mockk.mockkObject import java.util.Date 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.Bean import org.springframework.context.annotation.Configuration @@ -28,6 +29,7 @@ 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 import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.config.web.servlet.invoke import org.springframework.security.core.session.SessionInformation import org.springframework.security.core.session.SessionRegistry @@ -48,6 +50,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class SessionConcurrencyDslTests { @JvmField val spring = SpringTestContext(this) diff --git a/config/src/test/kotlin/org/springframework/security/config/web/servlet/session/SessionFixationDslTests.kt b/config/src/test/kotlin/org/springframework/security/config/web/servlet/session/SessionFixationDslTests.kt index 13349ac198..c28d939702 100644 --- a/config/src/test/kotlin/org/springframework/security/config/web/servlet/session/SessionFixationDslTests.kt +++ b/config/src/test/kotlin/org/springframework/security/config/web/servlet/session/SessionFixationDslTests.kt @@ -18,6 +18,7 @@ package org.springframework.security.config.web.servlet.session import org.assertj.core.api.Assertions.assertThat 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.Bean import org.springframework.context.annotation.Configuration @@ -29,6 +30,7 @@ import org.springframework.security.core.userdetails.User import org.springframework.security.core.userdetails.UserDetailsService import org.springframework.security.config.web.servlet.invoke import org.springframework.security.config.test.SpringTestContext +import org.springframework.security.config.test.SpringTestContextExtension import org.springframework.security.provisioning.InMemoryUserDetailsManager import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.httpBasic import org.springframework.test.web.servlet.MockMvc @@ -39,6 +41,7 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders * * @author Eleftheria Stein */ +@ExtendWith(SpringTestContextExtension::class) class SessionFixationDslTests { @JvmField var spring = SpringTestContext(this)