@Test public void ignoringMvcMatcher() throws Exception { loadConfig(MvcMatcherConfig.class); this.request.setRequestURI("/path"); this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain); assertThat(this.response.getStatus()).isEqualTo(HttpServletResponse.SC_OK); setup(); this.request.setRequestURI("/path.html"); this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain); assertThat(this.response.getStatus()).isEqualTo(HttpServletResponse.SC_OK); setup(); this.request.setRequestURI("/path/"); this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain); assertThat(this.response.getStatus()).isEqualTo(HttpServletResponse.SC_OK); setup(); this.request.setRequestURI("/other"); this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain); assertThat(this.response.getStatus()) .isEqualTo(HttpServletResponse.SC_UNAUTHORIZED); }
@Test public void ignoringMvcMatcherServletPath() throws Exception { loadConfig(MvcMatcherServletPathConfig.class); this.request.setServletPath("/spring"); this.request.setRequestURI("/spring/path"); this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain); assertThat(this.response.getStatus()).isEqualTo(HttpServletResponse.SC_OK); setup(); this.request.setServletPath("/spring"); this.request.setRequestURI("/spring/path.html"); this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain); assertThat(this.response.getStatus()).isEqualTo(HttpServletResponse.SC_OK); setup(); this.request.setServletPath("/spring"); this.request.setRequestURI("/spring/path/"); this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain); assertThat(this.response.getStatus()).isEqualTo(HttpServletResponse.SC_OK); setup(); this.request.setServletPath("/other"); this.request.setRequestURI("/other/path"); this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain); assertThat(this.response.getStatus()) .isEqualTo(HttpServletResponse.SC_UNAUTHORIZED); }