fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From my...@apache.org
Subject [fineract-cn-async] 02/13: added DelegatingSecurityContextAsyncTaskExecutor to delegate security context to child threads created via @Async
Date Mon, 22 Jan 2018 15:09:30 GMT
This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-async.git

commit 0e4bd4c3dbfa04f441ef5f6844d6b551b0db9634
Author: mgeiss <mgeiss@mifos.org>
AuthorDate: Wed Apr 12 07:45:08 2017 +0200

    added DelegatingSecurityContextAsyncTaskExecutor to delegate
    security context to child threads created via @Async
---
 build.gradle                                                           | 2 ++
 .../io/mifos/core/async/config/AsyncProcessingJavaConfiguration.java   | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/build.gradle b/build.gradle
index 7436af0..59040c4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -16,6 +16,7 @@ version '0.1.0-BUILD-SNAPSHOT'
 
 ext.versions = [
         springcontext        : '4.3.3.RELEASE',
+        springsecurity       : '4.2.2.RELEASE',
         springboot           : '1.4.1.RELEASE',
         findbugs             : '3.0.1',
 ]
@@ -40,6 +41,7 @@ repositories {
 dependencies {
     compile(
             [group: 'org.springframework', name: 'spring-context', version: versions.springcontext],
+            [group: 'org.springframework.security', name: 'spring-security-web', version:
versions.springsecurity],
             [group: 'com.google.code.findbugs', name: 'jsr305', version: versions.findbugs]
     )
 
diff --git a/src/main/java/io/mifos/core/async/config/AsyncProcessingJavaConfiguration.java
b/src/main/java/io/mifos/core/async/config/AsyncProcessingJavaConfiguration.java
index 32e7d68..1b966c0 100644
--- a/src/main/java/io/mifos/core/async/config/AsyncProcessingJavaConfiguration.java
+++ b/src/main/java/io/mifos/core/async/config/AsyncProcessingJavaConfiguration.java
@@ -24,6 +24,7 @@ import org.springframework.core.env.Environment;
 import org.springframework.scheduling.annotation.AsyncConfigurer;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import org.springframework.security.task.DelegatingSecurityContextAsyncTaskExecutor;
 
 import java.util.concurrent.Executor;
 
@@ -52,7 +53,7 @@ public class AsyncProcessingJavaConfiguration
     executor.setThreadNamePrefix(
         this.env.getProperty(AsyncConstants.THREAD_NAME_PROP, AsyncConstants.THREAD_NAME_DEFAULT));
     executor.initialize();
-    return executor;
+    return new DelegatingSecurityContextAsyncTaskExecutor(executor);
   }
 
   @Override

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.

Mime
View raw message