DelegatingSecurityContextTaskScheduler implements new Methods

Closes gh-11474
This commit is contained in:
Rob Winch 2022-07-08 12:29:09 -05:00
parent d2d5313bba
commit 03cd9920aa
1 changed files with 32 additions and 0 deletions

View File

@ -16,6 +16,9 @@
package org.springframework.security.scheduling;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.concurrent.ScheduledFuture;
@ -96,6 +99,35 @@ public class DelegatingSecurityContextTaskScheduler implements TaskScheduler {
return this.delegate.scheduleWithFixedDelay(wrap(task), delay);
}
@Override
public ScheduledFuture<?> schedule(Runnable task, Instant startTime) {
return delegate.schedule(wrap(task), startTime);
}
@Override
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Instant startTime, Duration period) {
return delegate.scheduleAtFixedRate(wrap(task), startTime, period);
}
@Override
public ScheduledFuture<?> scheduleAtFixedRate(Runnable task, Duration period) {
return delegate.scheduleAtFixedRate(wrap(task), period);
}
@Override
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Instant startTime, Duration delay) {
return delegate.scheduleWithFixedDelay(wrap(task), startTime, delay);
}
@Override
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, Duration delay) {
return delegate.scheduleWithFixedDelay(wrap(task), delay);
}
@Override
public Clock getClock() {
return this.delegate.getClock();
}
private Runnable wrap(Runnable delegate) {
return DelegatingSecurityContextRunnable.create(delegate, this.securityContext);
}