-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Spring Security config in samples #496
Comments
I solved the problem - turns out I needed to permit the route pattern:
I don't recall having to do this before (did Spring Security change to require it?), but in any case this fixes it. I think that in the spirit of having a more realistic example though, the sample project's |
Thanks for the report. Keep in mind the samples aren't going to remain as they are. They are also no longer building in the 1.1.x branch, but but we could make an update in the 1.0.x branch. @rwinch, any feedback from your side, on whether something changed, and if it makes sense to update the sample, irrespective? |
I am facing the same issue and added `permitAll()' but did not fix the problem |
I guess it's fixed in 3.0.1. After upgrading to 3.0.1, I am not facing the issue |
I'm having an issue using Spring Boot 3.0.0-M5 with Spring GraphQL where all authenticated webmvc calls return a 401. I've recreated it using the
webmvc-http-security
sample (though I wasn't actually able to run it out of this project based on the readme command - I copied the classes/resources over to a new maven project instead to get it running). To recreate:SecurityConfig
, change thepermitAll()
toauthenticated()
SecurityConfig
remove@EnableGlobalMethodSecurity
and inSalaryService
removePreAuthorize
andSecured
(just to remove authorization as a factor)No matter what's requested, a 401 is returned. I've dug into this a bit, and it seems like the reason lies with the async context the request is handled in. I can fix it by changing to use webflux (dependency, annotation, security config), but by then I've just recreated the
webflux-security
sample.The trace logs indicate that the GraphQL query executed just fine (and debugging confirms it), but notice that once the async state changes from
DISPATCHING
toDISPATCHED
, the security context gets lost and an anonymous user is set. This does happen after theAsyncContextImpl$DebugException
is logged, so maybe that has something to do with it?Thanks for looking at this! Other than this issue, I've been able to upgrade to Boot 3 with ease.
The text was updated successfully, but these errors were encountered: