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
ReactiveSecurityContextHolder.getContext().block() is null with custom AuthenticationToken (Sample provided) #5207
Comments
It occurred, that this was not a problem with documentation, but actually a bug!
|
+1 Same for me, I always get a |
Still a bug in 5.2.2, ReactiveSecurityContextHolder returns NEVER a context, not even when mocked in unit tests |
I have an issue, which pointed me here. I am trying to use |
You cannot use If you believe this is a bug, please provide a complete and minimal sample (i.e. GitHub repository) of the problem with details on how to reproduce the issue, what you expect to happen, and what actually happens. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
@rwinch - I have provided the sample project in my second comment two years ago (#5207 (comment)) |
Thanks for the pointer. Sorry I wasn't clear. I wasn't sure if someone had an example that does not use
More generally, you should not invoke I'm going to close this issue as invalid since the example uses |
Still not fixed without using block |
I can confirm it still doesn't work without using block(). |
Summary
Documentation here and here shows example of how to get
Authentication
token usingReactiveSecurityContextHolder.getContext()
but this is misleading because it always returns null!I spent days on trying to figure out what I'm doing wrong in my
AuthenticationManager
,ServerSecurityContextRepository
and/orWebFilter
s to get current logged user in my Controller:and finally I found this issue: #4790, changed my Controller to:
and it magically worked (still I have no idea why....)
Actual Behavior
Documentation is not clear on how to obtain UserDetails/Principle in Controller
Expected Behavior
Documentation should explain exactly what is written in this comment: #4790 (comment)
The text was updated successfully, but these errors were encountered: