spring-projects / spring-projects/spring-security

SEC-2909: Provide a DelegatingSecurityContextTaskScheduler

Open
#3,125 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core type: enhancement type: jira
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

Jon Kranes (Migrated from SEC-2909) said:

Currently Spring Security provides a DelegatingSecurityContextScheduledExecutorService that can wrap an instance of java.util.concurrent .ScheduledExecutorService, but there is no equivalent class to wrap an instance of org.springframework.scheduling.TaskScheduler.

This would be very useful because Spring's annotation based scheduling mechanism (using the @Scheduled annotation) depends on having some implementation of TaskScheduler. So currently there is no easy way to globally specify a SecurityContext to be used when these jobs are run (for example, we might want to run them using a special super-user or admin context as the scheduled jobs are time based and not associated with any particular user.)

Also, Spring's DefaultManagedTaskScheduler, which provides access to a JEE server's task scheduling mechanism, implements TaskScheduler but not ScheduledExecutorService. Thus any applications that want to use DefaultManagedTaskScheduler to schedule SecurityContext aware jobs would benefit from this wrapper class.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading DelegatingSecurityContextScheduledExecutorService and the org.springframework.scheduling.TaskScheduler interface to understand the existing delegation and scheduling methods. Implement the analogous wrapper for TaskScheduler, preserving SecurityContext execution for scheduled jobs, and verify that it supports the @Scheduled use case and DefaultManagedTaskScheduler integration described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, security
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.