Add Instructions Detailing Servlet Path Declaration in Migration Guides
https://docs.spring.io/spring-security/reference/migration-7/web.html#_include_the_servlet_path_prefix_in_authorization_rules is intended to alert applications that they need to now specify the servlet path in each authorization URI pattern.
It does not describe that Security supports configuring a global servlet path by publishing your own PathPatternRequestMatcher.Builder bean:
@Bean
PathPatternRequestMatcher.Builder requestMatcherBuilder(PathPatternParser mvcPatternParser, DispatcherServletPath servletPath) {
PathPatternRequestMatcher.Builder builder = new PathPatternRequestMatcher.withPathPatternParser(mvcPatternParser);
String path = servletPath.getPath();
return ("/".equals(path)) ? builder : builder.basePath(path);
}
The migration guide should be updated to demonstrate and explain this.
Hi @jzheaux,
I'd like to contribute to this documentation issue.
I noticed that the migration guide currently explains configuring the servlet path directly on PathPatternRequestMatcher.Builder, but does not cover the global PathPatternRequestMatcher.Builder bean approach described in this issue.
I'd be happy to update the migration guide with an example and explanation of this configuration.
Would you be okay with me submitting a PR for this?