spring-projects/spring-security
Document global servlet path matcher configuration
Contribution Overview
The Engineering Context
This contribution was made to the spring-projects/spring-securityopen-source repository. The work involved understanding the existing codebase, identifying the underlying engineering problem, implementing a focused solution, and validating the change against the project's existing behaviour and testing standards.
Original Issue
Clarify servlet path handling when configuring Spring Security request matchers.
Applications using a shared servlet path needed clearer guidance for configuring request matchers consistently across string-based authorization rules.
Engineering Problem
Understanding the Problem
The Spring Security migration documentation demonstrated an explicit basePath approach but did not document a reusable global PathPatternRequestMatcher.Builder configuration for applications where most authorization rules share the same servlet path.
Solution
Implementation Approach
Updated the Spring Security 7 migration guide with a global PathPatternRequestMatcher.Builder example using PathPatternRequestMatcher and DispatcherServletPath, allowing the configured servlet path to be applied consistently when building request matchers from string-based authorization methods.
Technologies
Engineering Stack
Pull Request
View the Contribution
View the pull request and the associated engineering discussion directly on GitHub.
View Pull Request on GitHub →