-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add DelegatingSecurityContextTaskScheduler #6257
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
Add DelegatingSecurityContextTaskScheduler #6257
Conversation
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 PR! I have provided feedback inline.
Can you also:
- create a specific
DelegatingSecurityContextTaskSchedulerTest
? - squash the commits
- ensure the remaining message aligns with the Spring Security conventions?
...ain/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskScheduler.java
Outdated
Show resolved
Hide resolved
...ain/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskScheduler.java
Outdated
Show resolved
Hide resolved
.../java/org/springframework/security/scheduling/AbstractSecurityContextTaskSchedulerTests.java
Outdated
Show resolved
Hide resolved
...springframework/security/scheduling/ExplicitSecurityContextSchedulingTaskSchedulerTests.java
Outdated
Show resolved
Hide resolved
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 changes!
- It appears that there are some checkstyle failures. Can you please look into fixing those:
[ant:checkstyle] [ERROR] /home/travis/build/spring-projects/spring-security/core/src/main/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskScheduler.java:38: Line has leading space characters; indentation should be performed with tabs only. [RegexpSinglelineJava]
[ant:checkstyle] [ERROR] /home/travis/build/spring-projects/spring-security/core/src/main/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskScheduler.java:54:52: ',' is not followed by whitespace. [WhitespaceAfter]
You can run checkstyle using ./gradlew checkstyleMain checkstyleTest
-
Can you please add tests?
-
Can you also please squash your commits and please update the commit message to align with the Spring Security conventions?
I will make those changes. |
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.
I am ready for sending this again. However, I miss the squash step. How can I fix that?
...springframework/security/scheduling/ExplicitSecurityContextSchedulingTaskSchedulerTests.java
Outdated
Show resolved
Hide resolved
...ain/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskScheduler.java
Outdated
Show resolved
Hide resolved
...ain/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskScheduler.java
Outdated
Show resolved
Hide resolved
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 tests. I have provided additional feedback inline
...java/org/springframework/security/scheduling/DelegatingSecurityContextTaskSchedulerTest.java
Outdated
Show resolved
Hide resolved
...ain/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskScheduler.java
Outdated
Show resolved
Hide resolved
...ain/java/org/springframework/security/scheduling/DelegatingSecurityContextTaskScheduler.java
Show resolved
Hide resolved
af83f72
to
fae0d4e
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 updates. I just noticed (sorry about that) that the documentation hasn't been updated yet. Can you please update it? Once that is done we will be ready to merge.
abstraction for Runnable that can be used for async and scheduled tasks. The primary contract for task scheduling is TaskScheduler and there's no such wrapper available at the moment. The new DelegatingSecurityContextTaskScheduler class implements TaskScheduler interface. Fixes spring-projectsgh-6043
fae0d4e
to
a95b6ff
Compare
Done. Thanks for all your help 😁 |
@richardvaldiviesomacias Thanks for the fast turnaround! This is now merged into master. Thank you for taking the time to make Spring better. We hope to see you again soon (submitting a PR, issue, etc)! If you are looking for issues to help with the label Help Wanted is a sign that the issue is relatively small. Just comment on the issue to claim it before starting work. |
Spring Security provides a TaskScheduler variant or the documentation routes users to expose a TaskScheduler bean rather than exposing a ScheduledExecutorService bean.
New file: DelegatingSecurityContextTaskScheduler which is a DelegatingSecurityContextAsyncTaskExecutor thant implements TaskScheduler.
ExplicitSecurityContextSchedulingTaskSchedulerTests and AbstractSecurityContextTaskSchedulerTests for testing.