-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Make scheduler configurable on ReactiveAuthenticationManagerAdapter #6852
Make scheduler configurable on ReactiveAuthenticationManagerAdapter #6852
Conversation
Thanks for the PR @ttddyy! Can you please help me better understand what problems you are trying to solve? |
Hi @rwinch The change has two aspect. First one is that we want to run the auth logic on controlled executor rather than the elastic one. Currently, it is hardcoded, so I want to make it changeable. The second point is after auth process has finished, we would like to switch the executor. Currently, since auth logic has switched to the elastic executor, subsequent logic (such as performing controller/service) also continue to be executed on the switched elastic executor. |
Ok I understand the what, but why are you needing to do this? Specifically, why do you need to switch back? What are you switching back to? |
I would like to publish to another executor that executes application logic. The main reason is to have metrics around the executors that perform auth logic and app logic separately. This way we can get independent metrics for auth and make decision on converting the auth part to full reactive or just use adapter approach. |
Can't you specify the executor for the logic you are executing? Why does this need to be part of Spring Security's code? |
OK, yeah executor for application can be specified outside of spring-security such as another webfilter or so. I'll update the PR to only focus on making auth-manager scheduler modifiable. |
44f6761
to
233117f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fast turnaround! I added one a comment inline.
* Set a scheduler that will be published on to perform the authentication logic. | ||
* @param scheduler a scheduler to be published on | ||
*/ | ||
public void setScheduler(Scheduler scheduler) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a null check and a test to validate the null check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the PR with null check and test
Currently, authentication logic will be performed on hardcoded elastic scheduler in ReactiveAuthenticationManagerAdapter. This commit makes the authentication logic scheduler configureable.
233117f
to
6d4f885
Compare
Hi @rwinch |
Thanks for the PR and the ping @ttddyy! This is now merged into master |
Currently, authentication logic will be performed on hardcoded elastic scheduler in
ReactiveAuthenticationManagerAdapter
.This needs to be configurable in order to perform the authentication logic in dedicated scheduler.
Also, once authentication is performed, rest of the logic(Controller/Service) also be performed on the published scheduler.
To allow the rest of the logic after authentication to run on different scheduler, adding another optional scheduler to publish on.
This PR is based on the usecase I have described here: reactor/reactor-core#1644 (comment)