mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-04 17:52:15 +00:00
DummyRequest supports methods for MvcRequestMatcher
To support MvcRequestMatcher DummyRequest needs to support getCharacterEncoding() and getAttribute(String)
This commit is contained in:
parent
ada146244e
commit
ca170f8479
@ -95,6 +95,13 @@ public class HttpSecurityRequestMatchersTests {
|
|||||||
.isEqualTo(HttpServletResponse.SC_UNAUTHORIZED);
|
.isEqualTo(HttpServletResponse.SC_UNAUTHORIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void mvcMatcherGetFiltersNoUnsupportedMethodExceptionFromDummyRequest() {
|
||||||
|
loadConfig(MvcMatcherConfig.class);
|
||||||
|
|
||||||
|
assertThat(springSecurityFilterChain.getFilters("/path")).isNotEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
|
@ -167,6 +167,14 @@ class DummyRequest extends HttpServletRequestWrapper {
|
|||||||
super(UNSUPPORTED_REQUEST);
|
super(UNSUPPORTED_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCharacterEncoding() {
|
||||||
|
return "UTF-8";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getAttribute(String attributeName) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void setRequestURI(String requestURI) {
|
public void setRequestURI(String requestURI) {
|
||||||
this.requestURI = requestURI;
|
this.requestURI = requestURI;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user