Introduce AsyncSystemTaskExecutor
[lgpl/argeo-commons.git] / security / runtime / org.argeo.security.core / src / main / java / org / argeo / security / core / KeyBasedSystemExecutionService.java
index 3235a9602bdad53f8aed8dcfe05765644353fdf1..3923715155dcd314a974984b7ec6d87f5a5750a2 100644 (file)
@@ -6,15 +6,16 @@ import javax.security.auth.Subject;
 
 import org.argeo.ArgeoException;
 import org.argeo.security.SystemExecutionService;
-import org.springframework.core.task.SimpleAsyncTaskExecutor;
-import org.springframework.core.task.TaskExecutor;
 import org.springframework.security.Authentication;
 import org.springframework.security.AuthenticationManager;
 import org.springframework.security.context.SecurityContext;
 import org.springframework.security.context.SecurityContextHolder;
 
-public class KeyBasedSystemExecutionService implements SystemExecutionService,
-               TaskExecutor {
+/**
+ * Implementation of a {@link SystemExecutionService} using a key-based
+ * {@link InternalAuthentication}
+ */
+public class KeyBasedSystemExecutionService implements SystemExecutionService {
        private AuthenticationManager authenticationManager;
        private String systemAuthenticationKey;
 
@@ -22,19 +23,6 @@ public class KeyBasedSystemExecutionService implements SystemExecutionService,
                wrapWithSystemAuthentication(runnable).run();
        }
 
-       public TaskExecutor createSystemAuthenticatedTaskExecutor() {
-               return new SimpleAsyncTaskExecutor() {
-                       private static final long serialVersionUID = -8126773862193265020L;
-
-                       @Override
-                       public Thread createThread(Runnable runnable) {
-                               return super
-                                               .createThread(wrapWithSystemAuthentication(runnable));
-                       }
-
-               };
-       }
-
        protected Runnable wrapWithSystemAuthentication(final Runnable runnable) {
                return new Runnable() {