diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityRequestMatchersTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityRequestMatchersTests.java index b86302bb9a..ca9b889239 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityRequestMatchersTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityRequestMatchersTests.java @@ -95,6 +95,13 @@ public class HttpSecurityRequestMatchersTests { .isEqualTo(HttpServletResponse.SC_UNAUTHORIZED); } + @Test + public void mvcMatcherGetFiltersNoUnsupportedMethodExceptionFromDummyRequest() { + loadConfig(MvcMatcherConfig.class); + + assertThat(springSecurityFilterChain.getFilters("/path")).isNotEmpty(); + } + @EnableWebSecurity @Configuration @EnableWebMvc diff --git a/web/src/main/java/org/springframework/security/web/FilterInvocation.java b/web/src/main/java/org/springframework/security/web/FilterInvocation.java index 99f6471b48..803f4e4b55 100644 --- a/web/src/main/java/org/springframework/security/web/FilterInvocation.java +++ b/web/src/main/java/org/springframework/security/web/FilterInvocation.java @@ -167,6 +167,14 @@ class DummyRequest extends HttpServletRequestWrapper { super(UNSUPPORTED_REQUEST); } + public String getCharacterEncoding() { + return "UTF-8"; + } + + public Object getAttribute(String attributeName) { + return null; + } + public void setRequestURI(String requestURI) { this.requestURI = requestURI; }