Disable CORS Tests Relying on HandlerMappingIntrospector
Spring Framework 7.1 removes HandlerMappingIntrospector-derived implicit CORS handling for plain requests; these tests assert the old behavior. Closes gh-19543 Signed-off-by: Josh Cummings <3627351+jzheaux@users.noreply.github.com>
This commit is contained in:
+13
@@ -20,6 +20,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.google.common.net.HttpHeaders;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
@@ -75,6 +76,15 @@ public class CorsConfigurerTests {
|
||||
+ "or are publishing a `CorsConfigurationSource` bean.");
|
||||
}
|
||||
|
||||
// FIXME: Spring Framework 7.1 removed HandlerMappingIntrospector, so there is no
|
||||
// longer a CorsConfigurationSource derivable from implicit @CrossOrigin/MVC config,
|
||||
// and PreFlightRequestFilter (the replacement) is a no-op for non-preflight
|
||||
// requests. Per https://github.com/spring-projects/spring-framework/issues/36481,
|
||||
// relying on implicit config for a plain request's CORS headers was "never an
|
||||
// intended way of using HandlerMappingIntrospector" and is not coming back; decide
|
||||
// whether to update this test to require an explicit CorsConfigurationSource bean
|
||||
// (matching the reactive stack's always-explicit model), then re-enable.
|
||||
@Disabled
|
||||
@Test
|
||||
public void getWhenCrossOriginAnnotationThenRespondsWithCorsHeaders() throws Exception {
|
||||
this.spring.register(MvcCorsConfig.class).autowire();
|
||||
@@ -95,6 +105,9 @@ public class CorsConfigurerTests {
|
||||
.andExpect(header().exists("X-Content-Type-Options"));
|
||||
}
|
||||
|
||||
// FIXME: see FIXME on getWhenCrossOriginAnnotationThenRespondsWithCorsHeaders above;
|
||||
// same root cause (Framework 7.1 removed HandlerMappingIntrospector).
|
||||
@Disabled
|
||||
@Test
|
||||
public void getWhenDefaultsInLambdaAndCrossOriginAnnotationThenRespondsWithCorsHeaders() throws Exception {
|
||||
this.spring.register(MvcCorsInLambdaConfig.class).autowire();
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.security.config.http;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
@@ -67,6 +68,14 @@ public class HttpCorsConfigTests {
|
||||
"Please ensure Spring Security & Spring MVC are configured in a shared ApplicationContext");
|
||||
}
|
||||
|
||||
// FIXME: Spring Framework 7.1 removed HandlerMappingIntrospector, which this test's
|
||||
// implicit (no configuration-source-ref) <cors/> scenario relied on to add CORS
|
||||
// headers to a plain, non-preflight request before authorization runs. Per
|
||||
// https://github.com/spring-projects/spring-framework/issues/36481, this was "never
|
||||
// an intended way of using HandlerMappingIntrospector" and is not coming back;
|
||||
// decide whether to update this test's expectations (e.g. require an explicit
|
||||
// CorsConfigurationSource bean) or remove the assertion, then re-enable.
|
||||
@Disabled
|
||||
@Test
|
||||
public void getWhenUsingCorsThenDoesSpringSecurityCorsHandshake() throws Exception {
|
||||
this.spring.configLocations(this.xml("WithCors")).autowire();
|
||||
|
||||
Reference in New Issue
Block a user