Skip to content

[#2969] - Propagate PathMatchingFilterChainResolver's PatternMatcher to PathMatchingFilters - #2970

Closed
4n86rakam1 wants to merge 2 commits into
apache:mainfrom
4n86rakam1:propagate-path-matcher
Closed

4n86rakam1 wants to merge 2 commits into
apache:mainfrom
4n86rakam1:propagate-path-matcher

Conversation

@4n86rakam1

@4n86rakam1 4n86rakam1 commented Nov 23, 2026 •

Copy link
Copy Markdown

PathMatchingFilterChainResolver.setPathMatcher() only replaced the resolver's own matcher. Each PathMatchingFilter kept its private AntPathMatcher and re-matched the request path in preHandle. With a different matcher (for example RegExPatternMatcher and /secure/[^/]+) the resolver selected the chain, but the filter's Ant matcher did not match the pattern, so preHandle returned true and the filter did nothing.

The resolver now applies its matcher to every PathMatchingFilter in its FilterChainManager, both in setPathMatcher() and in setFilterChainManager(). This mirrors what ShiroFilterFactoryBean already does for Spring (#2928).

Tests: two new cases in PathMatchingFilterChainResolverTest use a RegExPatternMatcher and a real PathMatchingFilter. They fail before the change and pass after it. ./mvnw -pl web -am verify passes (241 tests in web).

fixes #2969

  • Make sure there is a GitHub issue filed for the change.
  • Format the pull request title like [#XXX] - Fixes bug in SessionManager.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • add fixes #XXX if merging the PR should close a related issue.
  • Run mvn verify to make sure basic checks pass.
  • I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
  • In any other case, please file an Apache Individual Contributor License Agreement.

…tcher to PathMatchingFilters

PathMatchingFilterChainResolver.setPathMatcher() replaced only the
resolver's matcher, while each PathMatchingFilter re-matched the path
with its own AntPathMatcher. With a non-Ant matcher the resolver selected
a chain whose filters then skipped the request. Apply the resolver's
matcher to the PathMatchingFilters in its FilterChainManager, as
ShiroFilterFactoryBean already does for Spring.

fixes apache#2969

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the comment that repeated the Javadoc, the null check on getFilters()
that DefaultFilterChainManager never needs, and the test for re-applying
the matcher, which only backed the removed Javadoc note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lprimak lprimak added CLA and removed pending-cla labels Nov 23, 2026
@lprimak

lprimak commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution.
Unfortunately, the fix has too many regressions to accept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] PathMatchingFilterChainResolver.setPathMatcher() does not reach PathMatchingFilters

2 participants