Open
Description
Describe the bug
HttpSecurity configuration with securityMatcher
and oauth2Login(withDefaults())
leads to 404 for some OAuth2 endpoints.
To Reproduce
- Clone this repo: https://github.com/Haarolean/spring-security-matchers-bug
- Run the app
- Go to
http://localhost:8080/oauth2/authorization/github
- Observe 404
Also,
- Commenting line 25 in
OAuthSecurityConfig
fixes the issue. - Endpoint like
http://localhost:1337/login/oauth2/code/github?code=xxx
still works for some reason. - I've traced the issue down to
MvcRequestMatcher
, wherenotMatchMethodOrServletPath
always results intrue
. Without line 25,MvcRequestMatcher
is not used, ratherAnyRequestMatcher
is being used. - I've dug through all the possible documentation on
securityMatcher
and didn't find anything which could explain the problem.
Expected behavior
oauth, csrf, cors and other configurations are applied only for /api/web/**
.
Sample