diff --git a/zanata-war/src/main/java/org/zanata/async/AsynchronousTaskExecutor.java b/zanata-war/src/main/java/org/zanata/async/AsynchronousTaskExecutor.java index 00fb28a07d..7ab78ac715 100644 --- a/zanata-war/src/main/java/org/zanata/async/AsynchronousTaskExecutor.java +++ b/zanata-war/src/main/java/org/zanata/async/AsynchronousTaskExecutor.java @@ -29,7 +29,6 @@ import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.annotations.async.Asynchronous; -import org.jboss.seam.security.Identity; import org.jboss.seam.security.RunAsOperation; import lombok.extern.slf4j.Slf4j; @@ -49,7 +48,8 @@ public class AsynchronousTaskExecutor { @Asynchronous - public > void runAsynchronously(final AsyncTask task, final Identity runAs) + public > void runAsynchronously(final AsyncTask task, final Principal runAsPpal, + final Subject runAsSubject) { AsyncUtils.outject(task.getHandle(), ScopeType.EVENT); @@ -73,13 +73,13 @@ public void execute() @Override public Principal getPrincipal() { - return runAs.getPrincipal(); + return runAsPpal; } @Override public Subject getSubject() { - return runAs.getSubject(); + return runAsSubject; } }; diff --git a/zanata-war/src/main/java/org/zanata/async/TaskExecutor.java b/zanata-war/src/main/java/org/zanata/async/TaskExecutor.java index 0275ce0e18..2665be5dd1 100644 --- a/zanata-war/src/main/java/org/zanata/async/TaskExecutor.java +++ b/zanata-war/src/main/java/org/zanata/async/TaskExecutor.java @@ -57,7 +57,8 @@ public > AsyncTaskHandle startTask(AsyncTask< throw new RuntimeException("An Asynchronous task should always return a non-null handle"); } - asynchronousTaskExecutor.runAsynchronously(task, Identity.instance()); + Identity identity = Identity.instance(); + asynchronousTaskExecutor.runAsynchronously(task, identity.getPrincipal(), identity.getSubject()); return handle; }