Skip to content

Warn when securityMatcher misses oauth2Login URLs#18759

Open
wonderfulrosemari wants to merge 1 commit intospring-projects:mainfrom
wonderfulrosemari:gh-14096-securitymatcher-warning
Open

Warn when securityMatcher misses oauth2Login URLs#18759
wonderfulrosemari wants to merge 1 commit intospring-projects:mainfrom
wonderfulrosemari:gh-14096-securitymatcher-warning

Conversation

@wonderfulrosemari
Copy link
Contributor

Closes gh-14096

When oauth2Login() is configured together with a restrictive securityMatcher, it is easy to accidentally exclude one of the OAuth2 login endpoints, which can lead to 404 responses.

This change adds a warning when the configured securityMatcher does not match OAuth2 login endpoints.

Changes include:

  • expose the current HttpSecurity request matcher as a shared object
  • in OAuth2LoginConfigurer, warn when securityMatcher does not match:
    • authorization request endpoint (/oauth2/authorization/{registrationId} by default)
    • authorization response endpoint (/login/oauth2/code/* by default, or a custom redirection endpoint base URI)
  • add tests for warning and no-warning scenarios

Share HttpSecurity request matcher with configurers and use it in\nOAuth2LoginConfigurer to log a warning when oauth2Login endpoints are\noutside the configured securityMatcher.\n\nAdd tests for both warning and non-warning cases.\n\nCloses spring-projectsgh-14096

Signed-off-by: wonderfulrosemari <whwlsgur1419@naver.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider warning users if securityMatchers do not match some filter in the chain

2 participants