Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Instructions Detailing Servlet Path Declaration in Migration Guides #17811

Open
Assignees
Labels
in: docsAn issue in Documentation or samples type: bugA general bug
Milestone
@jzheaux

Description

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.

Metadata

Metadata

Assignees

Labels

in: docsAn issue in Documentation or samples type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    AltStyle によって変換されたページ (->オリジナル) /