diff --git a/config/spring-security-config.gradle b/config/spring-security-config.gradle index fd1f342ff1..54eee926bb 100644 --- a/config/spring-security-config.gradle +++ b/config/spring-security-config.gradle @@ -15,12 +15,13 @@ dependencies { optional project(':spring-security-jwt-jose') optional project(':spring-security-openid') optional project(':spring-security-web') - optional project(':spring-security-webflux') + optional 'io.projectreactor:reactor-core' optional 'org.aspectj:aspectjweaver' optional 'org.springframework:spring-jdbc' optional 'org.springframework:spring-tx' optional 'org.springframework:spring-webmvc' optional'org.springframework:spring-web' + optional'org.springframework:spring-webflux' optional'org.springframework:spring-websocket' provided 'javax.servlet:javax.servlet-api' @@ -28,7 +29,7 @@ dependencies { testCompile project(':spring-security-aspects') testCompile project(':spring-security-cas') testCompile project(path : ':spring-security-core', configuration : 'tests') - testCompile project(path : ':spring-security-webflux', configuration : 'tests') + testCompile project(path : ':spring-security-web', configuration : 'tests') testCompile apachedsDependencies testCompile powerMock2Dependencies testCompile spockDependencies diff --git a/samples/javaconfig/hellowebflux-method/spring-security-samples-javaconfig-hellowebflux-method.gradle b/samples/javaconfig/hellowebflux-method/spring-security-samples-javaconfig-hellowebflux-method.gradle index 53102778f1..13b8f50330 100644 --- a/samples/javaconfig/hellowebflux-method/spring-security-samples-javaconfig-hellowebflux-method.gradle +++ b/samples/javaconfig/hellowebflux-method/spring-security-samples-javaconfig-hellowebflux-method.gradle @@ -3,7 +3,7 @@ apply plugin: 'io.spring.convention.spring-sample' dependencies { compile project(':spring-security-core') compile project(':spring-security-config') - compile project(':spring-security-webflux') + compile project(':spring-security-web') compile 'com.fasterxml.jackson.core:jackson-databind' compile 'io.netty:netty-buffer' compile 'io.projectreactor.ipc:reactor-netty' diff --git a/samples/javaconfig/hellowebflux/spring-security-samples-javaconfig-hellowebflux.gradle b/samples/javaconfig/hellowebflux/spring-security-samples-javaconfig-hellowebflux.gradle index 53102778f1..13b8f50330 100644 --- a/samples/javaconfig/hellowebflux/spring-security-samples-javaconfig-hellowebflux.gradle +++ b/samples/javaconfig/hellowebflux/spring-security-samples-javaconfig-hellowebflux.gradle @@ -3,7 +3,7 @@ apply plugin: 'io.spring.convention.spring-sample' dependencies { compile project(':spring-security-core') compile project(':spring-security-config') - compile project(':spring-security-webflux') + compile project(':spring-security-web') compile 'com.fasterxml.jackson.core:jackson-databind' compile 'io.netty:netty-buffer' compile 'io.projectreactor.ipc:reactor-netty' diff --git a/samples/javaconfig/hellowebfluxfn/spring-security-samples-javaconfig-hellowebfluxfn.gradle b/samples/javaconfig/hellowebfluxfn/spring-security-samples-javaconfig-hellowebfluxfn.gradle index 53102778f1..13b8f50330 100644 --- a/samples/javaconfig/hellowebfluxfn/spring-security-samples-javaconfig-hellowebfluxfn.gradle +++ b/samples/javaconfig/hellowebfluxfn/spring-security-samples-javaconfig-hellowebfluxfn.gradle @@ -3,7 +3,7 @@ apply plugin: 'io.spring.convention.spring-sample' dependencies { compile project(':spring-security-core') compile project(':spring-security-config') - compile project(':spring-security-webflux') + compile project(':spring-security-web') compile 'com.fasterxml.jackson.core:jackson-databind' compile 'io.netty:netty-buffer' compile 'io.projectreactor.ipc:reactor-netty' diff --git a/web/spring-security-web.gradle b/web/spring-security-web.gradle index aad102acf6..bcb3f4a6b3 100644 --- a/web/spring-security-web.gradle +++ b/web/spring-security-web.gradle @@ -10,16 +10,20 @@ dependencies { compile 'org.springframework:spring-web' optional 'com.fasterxml.jackson.core:jackson-databind' + optional 'io.projectreactor:reactor-core' optional 'org.springframework:spring-jdbc' optional 'org.springframework:spring-tx' + optional 'org.springframework:spring-webflux' optional 'org.springframework:spring-webmvc' provided 'javax.servlet:javax.servlet-api' testCompile project(path: ':spring-security-core', configuration: 'tests') testCompile 'commons-codec:commons-codec' + testCompile 'io.projectreactor:reactor-test' testCompile 'org.codehaus.groovy:groovy-all' testCompile 'org.skyscreamer:jsonassert' + testCompile 'org.springframework:spring-webflux' testCompile powerMock2Dependencies testCompile spockDependencies testCompile slf4jDependencies diff --git a/webflux/src/main/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolver.java b/web/src/main/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolver.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolver.java rename to web/src/main/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolver.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/DefaultServerRedirectStrategy.java b/web/src/main/java/org/springframework/security/web/server/DefaultServerRedirectStrategy.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/DefaultServerRedirectStrategy.java rename to web/src/main/java/org/springframework/security/web/server/DefaultServerRedirectStrategy.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPoint.java b/web/src/main/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPoint.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPoint.java rename to web/src/main/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPoint.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/MatcherSecurityWebFilterChain.java b/web/src/main/java/org/springframework/security/web/server/MatcherSecurityWebFilterChain.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/MatcherSecurityWebFilterChain.java rename to web/src/main/java/org/springframework/security/web/server/MatcherSecurityWebFilterChain.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/SecurityWebFilterChain.java b/web/src/main/java/org/springframework/security/web/server/SecurityWebFilterChain.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/SecurityWebFilterChain.java rename to web/src/main/java/org/springframework/security/web/server/SecurityWebFilterChain.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/ServerAuthenticationEntryPoint.java b/web/src/main/java/org/springframework/security/web/server/ServerAuthenticationEntryPoint.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/ServerAuthenticationEntryPoint.java rename to web/src/main/java/org/springframework/security/web/server/ServerAuthenticationEntryPoint.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverter.java b/web/src/main/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverter.java rename to web/src/main/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverter.java b/web/src/main/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverter.java rename to web/src/main/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/ServerRedirectStrategy.java b/web/src/main/java/org/springframework/security/web/server/ServerRedirectStrategy.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/ServerRedirectStrategy.java rename to web/src/main/java/org/springframework/security/web/server/ServerRedirectStrategy.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/WebFilterChainProxy.java b/web/src/main/java/org/springframework/security/web/server/WebFilterChainProxy.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/WebFilterChainProxy.java rename to web/src/main/java/org/springframework/security/web/server/WebFilterChainProxy.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/WebFilterExchange.java b/web/src/main/java/org/springframework/security/web/server/WebFilterExchange.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/WebFilterExchange.java rename to web/src/main/java/org/springframework/security/web/server/WebFilterExchange.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/AuthenticationWebFilter.java b/web/src/main/java/org/springframework/security/web/server/authentication/AuthenticationWebFilter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/AuthenticationWebFilter.java rename to web/src/main/java/org/springframework/security/web/server/authentication/AuthenticationWebFilter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPoint.java b/web/src/main/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPoint.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPoint.java rename to web/src/main/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPoint.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPoint.java b/web/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPoint.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPoint.java rename to web/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPoint.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandler.java b/web/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandler.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandler.java rename to web/src/main/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandler.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandler.java b/web/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandler.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandler.java rename to web/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandler.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationFailureHandler.java b/web/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationFailureHandler.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationFailureHandler.java rename to web/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationFailureHandler.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationSuccessHandler.java b/web/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationSuccessHandler.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationSuccessHandler.java rename to web/src/main/java/org/springframework/security/web/server/authentication/ServerAuthenticationSuccessHandler.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/WebFilterChainServerAuthenticationSuccessHandler.java b/web/src/main/java/org/springframework/security/web/server/authentication/WebFilterChainServerAuthenticationSuccessHandler.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/WebFilterChainServerAuthenticationSuccessHandler.java rename to web/src/main/java/org/springframework/security/web/server/authentication/WebFilterChainServerAuthenticationSuccessHandler.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/logout/LogoutWebFilter.java b/web/src/main/java/org/springframework/security/web/server/authentication/logout/LogoutWebFilter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/logout/LogoutWebFilter.java rename to web/src/main/java/org/springframework/security/web/server/authentication/logout/LogoutWebFilter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/logout/RedirectServerLogoutSuccessHandler.java b/web/src/main/java/org/springframework/security/web/server/authentication/logout/RedirectServerLogoutSuccessHandler.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/logout/RedirectServerLogoutSuccessHandler.java rename to web/src/main/java/org/springframework/security/web/server/authentication/logout/RedirectServerLogoutSuccessHandler.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/logout/SecurityContextServerLogoutHandler.java b/web/src/main/java/org/springframework/security/web/server/authentication/logout/SecurityContextServerLogoutHandler.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/logout/SecurityContextServerLogoutHandler.java rename to web/src/main/java/org/springframework/security/web/server/authentication/logout/SecurityContextServerLogoutHandler.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/logout/ServerLogoutHandler.java b/web/src/main/java/org/springframework/security/web/server/authentication/logout/ServerLogoutHandler.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/logout/ServerLogoutHandler.java rename to web/src/main/java/org/springframework/security/web/server/authentication/logout/ServerLogoutHandler.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authentication/logout/ServerLogoutSuccessHandler.java b/web/src/main/java/org/springframework/security/web/server/authentication/logout/ServerLogoutSuccessHandler.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authentication/logout/ServerLogoutSuccessHandler.java rename to web/src/main/java/org/springframework/security/web/server/authentication/logout/ServerLogoutSuccessHandler.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authorization/AuthorizationContext.java b/web/src/main/java/org/springframework/security/web/server/authorization/AuthorizationContext.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authorization/AuthorizationContext.java rename to web/src/main/java/org/springframework/security/web/server/authorization/AuthorizationContext.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authorization/AuthorizationWebFilter.java b/web/src/main/java/org/springframework/security/web/server/authorization/AuthorizationWebFilter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authorization/AuthorizationWebFilter.java rename to web/src/main/java/org/springframework/security/web/server/authorization/AuthorizationWebFilter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManager.java b/web/src/main/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManager.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManager.java rename to web/src/main/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManager.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilter.java b/web/src/main/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilter.java rename to web/src/main/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandler.java b/web/src/main/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandler.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandler.java rename to web/src/main/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandler.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/authorization/ServerAccessDeniedHandler.java b/web/src/main/java/org/springframework/security/web/server/authorization/ServerAccessDeniedHandler.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/authorization/ServerAccessDeniedHandler.java rename to web/src/main/java/org/springframework/security/web/server/authorization/ServerAccessDeniedHandler.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/context/AuthenticationReactorContextWebFilter.java b/web/src/main/java/org/springframework/security/web/server/context/AuthenticationReactorContextWebFilter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/context/AuthenticationReactorContextWebFilter.java rename to web/src/main/java/org/springframework/security/web/server/context/AuthenticationReactorContextWebFilter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/context/SecurityContextRepositoryServerWebExchange.java b/web/src/main/java/org/springframework/security/web/server/context/SecurityContextRepositoryServerWebExchange.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/context/SecurityContextRepositoryServerWebExchange.java rename to web/src/main/java/org/springframework/security/web/server/context/SecurityContextRepositoryServerWebExchange.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/context/SecurityContextRepositoryWebFilter.java b/web/src/main/java/org/springframework/security/web/server/context/SecurityContextRepositoryWebFilter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/context/SecurityContextRepositoryWebFilter.java rename to web/src/main/java/org/springframework/security/web/server/context/SecurityContextRepositoryWebFilter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/context/ServerSecurityContextRepository.java b/web/src/main/java/org/springframework/security/web/server/context/ServerSecurityContextRepository.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/context/ServerSecurityContextRepository.java rename to web/src/main/java/org/springframework/security/web/server/context/ServerSecurityContextRepository.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/context/ServerWebExchangeAttributeServerSecurityContextRepository.java b/web/src/main/java/org/springframework/security/web/server/context/ServerWebExchangeAttributeServerSecurityContextRepository.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/context/ServerWebExchangeAttributeServerSecurityContextRepository.java rename to web/src/main/java/org/springframework/security/web/server/context/ServerWebExchangeAttributeServerSecurityContextRepository.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/context/WebSessionServerSecurityContextRepository.java b/web/src/main/java/org/springframework/security/web/server/context/WebSessionServerSecurityContextRepository.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/context/WebSessionServerSecurityContextRepository.java rename to web/src/main/java/org/springframework/security/web/server/context/WebSessionServerSecurityContextRepository.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriter.java b/web/src/main/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriter.java rename to web/src/main/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriter.java b/web/src/main/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriter.java rename to web/src/main/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/header/ContentTypeOptionsServerHttpHeadersWriter.java b/web/src/main/java/org/springframework/security/web/server/header/ContentTypeOptionsServerHttpHeadersWriter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/header/ContentTypeOptionsServerHttpHeadersWriter.java rename to web/src/main/java/org/springframework/security/web/server/header/ContentTypeOptionsServerHttpHeadersWriter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilter.java b/web/src/main/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilter.java rename to web/src/main/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/header/ServerHttpHeadersWriter.java b/web/src/main/java/org/springframework/security/web/server/header/ServerHttpHeadersWriter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/header/ServerHttpHeadersWriter.java rename to web/src/main/java/org/springframework/security/web/server/header/ServerHttpHeadersWriter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriter.java b/web/src/main/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriter.java rename to web/src/main/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriter.java b/web/src/main/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriter.java rename to web/src/main/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriter.java b/web/src/main/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriter.java rename to web/src/main/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriter.java b/web/src/main/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriter.java rename to web/src/main/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriter.java b/web/src/main/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriter.java rename to web/src/main/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilter.java b/web/src/main/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilter.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilter.java rename to web/src/main/java/org/springframework/security/web/server/ui/LoginPageGeneratingWebFilter.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcher.java b/web/src/main/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcher.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcher.java rename to web/src/main/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcher.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcher.java b/web/src/main/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcher.java similarity index 83% rename from webflux/src/main/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcher.java rename to web/src/main/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcher.java index 8fb1491ed4..58d14cea77 100644 --- a/webflux/src/main/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcher.java +++ b/web/src/main/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcher.java @@ -24,13 +24,12 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.http.InvalidMediaTypeException; import reactor.core.publisher.Mono; import org.springframework.http.MediaType; import org.springframework.util.Assert; import org.springframework.web.accept.ContentNegotiationStrategy; -import org.springframework.web.reactive.accept.HeaderContentTypeResolver; -import org.springframework.web.reactive.accept.RequestedContentTypeResolver; import org.springframework.web.server.NotAcceptableStatusException; import org.springframework.web.server.ServerWebExchange; @@ -40,7 +39,6 @@ import org.springframework.web.server.ServerWebExchange; */ public class MediaTypeServerWebExchangeMatcher implements ServerWebExchangeMatcher { private final Log logger = LogFactory.getLog(getClass()); - private RequestedContentTypeResolver requestedContentTypeResolver = new HeaderContentTypeResolver(); private final Collection matchingMediaTypes; private boolean useEquals; @@ -62,7 +60,7 @@ public class MediaTypeServerWebExchangeMatcher implements ServerWebExchangeMatch public Mono matches(ServerWebExchange exchange) { List httpRequestMediaTypes; try { - httpRequestMediaTypes = this.requestedContentTypeResolver.resolveMediaTypes(exchange); + httpRequestMediaTypes = resolveMediaTypes(exchange); } catch (NotAcceptableStatusException e) { this.logger.debug("Failed to parse MediaTypes, returning false", e); @@ -121,16 +119,6 @@ public class MediaTypeServerWebExchangeMatcher implements ServerWebExchangeMatch this.useEquals = useEquals; } - /** - * Sets the {@link RequestedContentTypeResolver} to be used - * @param requestedContentTypeResolver the resolver to use. Default is {@link HeaderContentTypeResolver} - */ - public void setRequestedContentTypeResolver( - RequestedContentTypeResolver requestedContentTypeResolver) { - Assert.notNull(requestedContentTypeResolver, "requestedContentTypeResolver cannot be null"); - this.requestedContentTypeResolver = requestedContentTypeResolver; - } - /** * Set the {@link MediaType} to ignore from the {@link ContentNegotiationStrategy}. * This is useful if for example, you want to match on @@ -143,10 +131,22 @@ public class MediaTypeServerWebExchangeMatcher implements ServerWebExchangeMatch this.ignoredMediaTypes = ignoredMediaTypes; } + private List resolveMediaTypes(ServerWebExchange exchange) throws NotAcceptableStatusException { + try { + List mediaTypes = exchange.getRequest().getHeaders().getAccept(); + MediaType.sortBySpecificityAndQuality(mediaTypes); + return mediaTypes; + } + catch (InvalidMediaTypeException ex) { + String value = exchange.getRequest().getHeaders().getFirst("Accept"); + throw new NotAcceptableStatusException( + "Could not parse 'Accept' header [" + value + "]: " + ex.getMessage()); + } + } + @Override public String toString() { - return "MediaTypeRequestMatcher [requestedContentTypeResolver=" - + this.requestedContentTypeResolver + ", matchingMediaTypes=" + return "MediaTypeRequestMatcher [matchingMediaTypes=" + this.matchingMediaTypes + ", useEquals=" + this.useEquals + ", ignoredMediaTypes=" + this.ignoredMediaTypes + "]"; } diff --git a/webflux/src/main/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcher.java b/web/src/main/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcher.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcher.java rename to web/src/main/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcher.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/util/matcher/PathPatternParserServerWebExchangeMatcher.java b/web/src/main/java/org/springframework/security/web/server/util/matcher/PathPatternParserServerWebExchangeMatcher.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/util/matcher/PathPatternParserServerWebExchangeMatcher.java rename to web/src/main/java/org/springframework/security/web/server/util/matcher/PathPatternParserServerWebExchangeMatcher.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatcher.java b/web/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatcher.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatcher.java rename to web/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatcher.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatcherEntry.java b/web/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatcherEntry.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatcherEntry.java rename to web/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatcherEntry.java diff --git a/webflux/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchers.java b/web/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchers.java similarity index 100% rename from webflux/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchers.java rename to web/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchers.java diff --git a/webflux/src/test/java/org/springframework/security/test/web/reactive/server/WebTestClientBuilder.java b/web/src/test/java/org/springframework/security/test/web/reactive/server/WebTestClientBuilder.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/test/web/reactive/server/WebTestClientBuilder.java rename to web/src/test/java/org/springframework/security/test/web/reactive/server/WebTestClientBuilder.java diff --git a/webflux/src/test/java/org/springframework/security/test/web/reactive/server/WebTestHandler.java b/web/src/test/java/org/springframework/security/test/web/reactive/server/WebTestHandler.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/test/web/reactive/server/WebTestHandler.java rename to web/src/test/java/org/springframework/security/test/web/reactive/server/WebTestHandler.java diff --git a/webflux/src/test/java/org/springframework/security/web/method/ResolvableMethod.java b/web/src/test/java/org/springframework/security/web/method/ResolvableMethod.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/method/ResolvableMethod.java rename to web/src/test/java/org/springframework/security/web/method/ResolvableMethod.java diff --git a/webflux/src/test/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolverTests.java b/web/src/test/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolverTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolverTests.java rename to web/src/test/java/org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolverTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/DefaultServerRedirectStrategyTests.java b/web/src/test/java/org/springframework/security/web/server/DefaultServerRedirectStrategyTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/DefaultServerRedirectStrategyTests.java rename to web/src/test/java/org/springframework/security/web/server/DefaultServerRedirectStrategyTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPointTests.java b/web/src/test/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPointTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPointTests.java rename to web/src/test/java/org/springframework/security/web/server/DelegatingServerAuthenticationEntryPointTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverterTests.java b/web/src/test/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverterTests.java rename to web/src/test/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverterTests.java b/web/src/test/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverterTests.java rename to web/src/test/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/WebFilterExchangeTests.java b/web/src/test/java/org/springframework/security/web/server/WebFilterExchangeTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/WebFilterExchangeTests.java rename to web/src/test/java/org/springframework/security/web/server/WebFilterExchangeTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/authentication/AuthenticationWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationWebFilterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/authentication/AuthenticationWebFilterTests.java rename to web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationWebFilterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPointTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPointTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPointTests.java rename to web/src/test/java/org/springframework/security/web/server/authentication/HttpBasicServerAuthenticationEntryPointTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPointTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPointTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPointTests.java rename to web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationEntryPointTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandlerTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandlerTests.java rename to web/src/test/java/org/springframework/security/web/server/authentication/RedirectServerAuthenticationSuccessHandlerTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandlerTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandlerTests.java rename to web/src/test/java/org/springframework/security/web/server/authentication/ServerAuthenticationEntryPointFailureHandlerTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManagerTests.java b/web/src/test/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManagerTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManagerTests.java rename to web/src/test/java/org/springframework/security/web/server/authorization/DelegatingReactiveAuthorizationManagerTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilterTests.java rename to web/src/test/java/org/springframework/security/web/server/authorization/ExceptionTranslationWebFilterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandlerTests.java b/web/src/test/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandlerTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandlerTests.java rename to web/src/test/java/org/springframework/security/web/server/authorization/HttpStatusServerAccessDeniedHandlerTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/context/AuthenticationReactorContextWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/context/AuthenticationReactorContextWebFilterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/context/AuthenticationReactorContextWebFilterTests.java rename to web/src/test/java/org/springframework/security/web/server/context/AuthenticationReactorContextWebFilterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/context/ServerSecurityContextRepositoryWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/context/ServerSecurityContextRepositoryWebFilterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/context/ServerSecurityContextRepositoryWebFilterTests.java rename to web/src/test/java/org/springframework/security/web/server/context/ServerSecurityContextRepositoryWebFilterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/context/ServerWebExchangeAttributeServerSecurityContextRepositoryTests.java b/web/src/test/java/org/springframework/security/web/server/context/ServerWebExchangeAttributeServerSecurityContextRepositoryTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/context/ServerWebExchangeAttributeServerSecurityContextRepositoryTests.java rename to web/src/test/java/org/springframework/security/web/server/context/ServerWebExchangeAttributeServerSecurityContextRepositoryTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriterTests.java rename to web/src/test/java/org/springframework/security/web/server/header/CacheControlServerHttpHeadersWriterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriterTests.java rename to web/src/test/java/org/springframework/security/web/server/header/CompositeServerHttpHeadersWriterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilterTests.java b/web/src/test/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilterTests.java rename to web/src/test/java/org/springframework/security/web/server/header/HttpHeaderWriterWebFilterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriterTests.java rename to web/src/test/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriterTests.java rename to web/src/test/java/org/springframework/security/web/server/header/StrictTransportSecurityServerHttpHeadersWriterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriterTests.java rename to web/src/test/java/org/springframework/security/web/server/header/XContentTypeOptionsServerHttpHeadersWriterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriterTests.java rename to web/src/test/java/org/springframework/security/web/server/header/XFrameOptionsServerHttpHeadersWriterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriterTests.java b/web/src/test/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriterTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriterTests.java rename to web/src/test/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriterTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcherTests.java b/web/src/test/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcherTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcherTests.java rename to web/src/test/java/org/springframework/security/web/server/util/matcher/AndServerWebExchangeMatcherTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcherTests.java b/web/src/test/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcherTests.java similarity index 75% rename from webflux/src/test/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcherTests.java rename to web/src/test/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcherTests.java index 4ff55eb81e..e42a41f766 100644 --- a/webflux/src/test/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcherTests.java +++ b/web/src/test/java/org/springframework/security/web/server/util/matcher/MediaTypeServerWebExchangeMatcherTests.java @@ -16,34 +16,23 @@ package org.springframework.security.web.server.util.matcher; -import java.util.Arrays; import java.util.Collections; import java.util.List; import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; import org.springframework.http.MediaType; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; import org.springframework.mock.web.server.MockServerWebExchange; -import org.springframework.web.reactive.accept.RequestedContentTypeResolver; import org.springframework.web.server.ServerWebExchange; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.when; /** * @author Rob Winch * @since 5.0 */ -@RunWith(MockitoJUnitRunner.class) public class MediaTypeServerWebExchangeMatcherTests { - @Mock - private RequestedContentTypeResolver resolver; - private MediaTypeServerWebExchangeMatcher matcher; @Test(expected = IllegalArgumentException.class) @@ -111,26 +100,6 @@ public class MediaTypeServerWebExchangeMatcherTests { assertThat(matcher.matches(exchange(MediaType.TEXT_HTML)).block().isMatch()).isFalse(); } - @Test - public void matchWhenCustomResolverAndAcceptEqualThenMatch() { - MediaType acceptType = MediaType.TEXT_HTML; - when(this.resolver.resolveMediaTypes(any())).thenReturn(Arrays.asList(acceptType)); - MediaTypeServerWebExchangeMatcher matcher = new MediaTypeServerWebExchangeMatcher(acceptType); - matcher.setRequestedContentTypeResolver(this.resolver); - - assertThat(matcher.matches(exchange(acceptType)).block().isMatch()).isTrue(); - } - - @Test - public void matchWhenCustomResolverAndDifferentAcceptThenNotMatch() { - MediaType acceptType = MediaType.TEXT_HTML; - when(this.resolver.resolveMediaTypes(any())).thenReturn(Arrays.asList(acceptType)); - MediaTypeServerWebExchangeMatcher matcher = new MediaTypeServerWebExchangeMatcher(MediaType.APPLICATION_JSON); - matcher.setRequestedContentTypeResolver(this.resolver); - - assertThat(matcher.matches(exchange(acceptType)).block().isMatch()).isFalse(); - } - private static ServerWebExchange exchange(MediaType... accept) { return MockServerWebExchange.from(MockServerHttpRequest.get("/").accept(accept).build()); } diff --git a/webflux/src/test/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcherTests.java b/web/src/test/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcherTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcherTests.java rename to web/src/test/java/org/springframework/security/web/server/util/matcher/OrServerWebExchangeMatcherTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/util/matcher/PathMatcherServerWebExchangeMatcherTests.java b/web/src/test/java/org/springframework/security/web/server/util/matcher/PathMatcherServerWebExchangeMatcherTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/util/matcher/PathMatcherServerWebExchangeMatcherTests.java rename to web/src/test/java/org/springframework/security/web/server/util/matcher/PathMatcherServerWebExchangeMatcherTests.java diff --git a/webflux/src/test/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchersTests.java b/web/src/test/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchersTests.java similarity index 100% rename from webflux/src/test/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchersTests.java rename to web/src/test/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchersTests.java diff --git a/webflux/spring-security-webflux.gradle b/webflux/spring-security-webflux.gradle deleted file mode 100644 index 5387762280..0000000000 --- a/webflux/spring-security-webflux.gradle +++ /dev/null @@ -1,13 +0,0 @@ -apply plugin: 'io.spring.convention.spring-module' - -dependencies { - compile project(':spring-security-core') - compile project(':spring-security-web') - compile 'org.springframework:spring-webflux' - - testCompile 'io.projectreactor:reactor-test' - testCompile 'org.springframework:spring-test' - - integrationTestCompile 'com.squareup.okhttp3:mockwebserver' - integrationTestCompile 'io.projectreactor.ipc:reactor-netty' -} diff --git a/webflux/src/integration-test/java/webclient/oauth2/poc/WebClientOAuth2PocTests.java b/webflux/src/integration-test/java/webclient/oauth2/poc/WebClientOAuth2PocTests.java deleted file mode 100644 index 0015d58ec9..0000000000 --- a/webflux/src/integration-test/java/webclient/oauth2/poc/WebClientOAuth2PocTests.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2002-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package webclient.oauth2.poc; - -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.springframework.http.HttpStatus; -import org.springframework.web.reactive.function.client.ClientRequest; -import org.springframework.web.reactive.function.client.ClientResponse; -import org.springframework.web.reactive.function.client.ExchangeFilterFunction; -import org.springframework.web.reactive.function.client.WebClient; -import reactor.core.publisher.Mono; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.web.reactive.function.client.ExchangeFilterFunctions.basicAuthentication; - -/** - * @author Rob Winch - * @since 5.0 - */ -public class WebClientOAuth2PocTests { - - private MockWebServer server; - - private WebClient webClient; - - - @Before - public void setup() { - this.server = new MockWebServer(); - String baseUrl = this.server.url("/").toString(); - this.webClient = WebClient.create(baseUrl); - } - - @After - public void shutdown() throws Exception { - this.server.shutdown(); - } - - @Test - public void httpBasicWhenNeeded() throws Exception { - this.server.enqueue(new MockResponse().setResponseCode(401).setHeader("WWW-Authenticate", "Basic realm=\"Test\"")); - this.server.enqueue(new MockResponse().setResponseCode(200).setBody("OK")); - - ClientResponse response = this.webClient - .mutate() - .filter(basicIfNeeded("rob", "rob")) - .build() - .get() - .uri("/") - .exchange() - .block(); - - assertThat(response.statusCode()).isEqualTo(HttpStatus.OK); - - assertThat(this.server.takeRequest().getHeader("Authorization")).isNull(); - assertThat(this.server.takeRequest().getHeader("Authorization")).isEqualTo("Basic cm9iOnJvYg=="); - } - - - @Test - public void httpBasicWhenNotNeeded() throws Exception { - this.server.enqueue(new MockResponse().setResponseCode(200).setBody("OK")); - - ClientResponse response = this.webClient - .mutate() - .filter(basicIfNeeded("rob", "rob")) - .build() - .get() - .uri("/") - .exchange() - .block(); - - assertThat(response.statusCode()).isEqualTo(HttpStatus.OK); - - assertThat(this.server.getRequestCount()).isEqualTo(1); - assertThat(this.server.takeRequest().getHeader("Authorization")).isNull(); - } - - private ExchangeFilterFunction basicIfNeeded(String username, String password) { - return (request, next) -> - next.exchange(request) - .filter( r -> !HttpStatus.UNAUTHORIZED.equals(r.statusCode())) - .switchIfEmpty( Mono.defer(() -> { - return basicAuthentication(username, password).filter(request, next); - })); - } -} diff --git a/webflux/src/test/resources/logback-test.xml b/webflux/src/test/resources/logback-test.xml deleted file mode 100644 index 2d51ba4180..0000000000 --- a/webflux/src/test/resources/logback-test.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - -