From 098e868d40b2130c6735b1547247c61a5d88da95 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Fri, 2 Mar 2012 16:41:59 +0000 Subject: [PATCH] Revert explicit security context propagation git-svn-id: https://svn.argeo.org/slc/trunk@5140 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../slc/core/execution/ExecutionThread.java | 13 +++++------- .../slc/core/execution/ProcessThread.java | 21 ++++++++++--------- .../core/execution/ProcessThreadGroup.java | 14 ++++++------- .../org/argeo/slc/osgi/BundlesManager.java | 2 +- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java index 23bb947ee..075a851dc 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java @@ -18,12 +18,9 @@ package org.argeo.slc.core.execution; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.argeo.slc.SlcException; import org.argeo.slc.execution.ExecutionFlowDescriptor; import org.argeo.slc.execution.ExecutionStep; import org.argeo.slc.process.RealizedFlow; -import org.springframework.security.Authentication; -import org.springframework.security.context.SecurityContextHolder; /** Thread of a single execution */ public class ExecutionThread extends Thread { @@ -44,11 +41,11 @@ public class ExecutionThread extends Thread { public void run() { // authenticate thread - Authentication authentication = getProcessThreadGroup() - .getAuthentication(); - if (authentication == null) - throw new SlcException("Can only execute authenticated threads"); - SecurityContextHolder.getContext().setAuthentication(authentication); +// Authentication authentication = getProcessThreadGroup() +// .getAuthentication(); +// if (authentication == null) +// throw new SlcException("Can only execute authenticated threads"); +// SecurityContextHolder.getContext().setAuthentication(authentication); if (getContextClassLoader() != null) { if (log.isTraceEnabled()) diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThread.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThread.java index 3117a3fd5..98d715ece 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThread.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThread.java @@ -30,8 +30,6 @@ import org.argeo.slc.execution.ExecutionProcess; import org.argeo.slc.execution.ExecutionStep; import org.argeo.slc.process.RealizedFlow; import org.argeo.slc.process.SlcExecution; -import org.springframework.security.Authentication; -import org.springframework.security.context.SecurityContextHolder; /** Thread of the SLC Process, starting the sub executions. */ @SuppressWarnings("deprecation") @@ -60,14 +58,17 @@ public class ProcessThread extends Thread { public final void run() { // authenticate thread - Authentication authentication = getProcessThreadGroup() - .getAuthentication(); - if (authentication == null) - throw new SlcException("Can only execute authenticated threads"); - SecurityContextHolder.getContext().setAuthentication(authentication); - - log.info("\n##\n## SLC Process #" + process.getUuid() + " STARTED by " - + authentication.getName() + "\n##\n"); + // Authentication authentication = getProcessThreadGroup() + // .getAuthentication(); + // if (authentication == null) + // throw new SlcException("Can only execute authenticated threads"); + // SecurityContextHolder.getContext().setAuthentication(authentication); + + // log.info("\n##\n## SLC Process #" + process.getUuid() + + // " STARTED by " + // + authentication.getName() + "\n##\n"); + log.info("\n##\n## SLC Process #" + process.getUuid() + + " STARTED\n##\n"); // Start logging new LoggingThread().start(); diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThreadGroup.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThreadGroup.java index d7fa4f959..03b72f605 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThreadGroup.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ProcessThreadGroup.java @@ -26,15 +26,13 @@ import org.argeo.slc.execution.ExecutionProcess; import org.argeo.slc.execution.ExecutionStep; import org.argeo.slc.process.SlcExecution; import org.argeo.slc.process.SlcExecutionStep; -import org.springframework.security.Authentication; -import org.springframework.security.context.SecurityContextHolder; /** The thread group attached to a given {@link SlcExecution}. */ @SuppressWarnings("deprecation") public class ProcessThreadGroup extends ThreadGroup { private final ExecutionModulesManager executionModulesManager; private final ProcessThread processThread; - private final Authentication authentication; +// private final Authentication authentication; private final static Integer STEPS_BUFFER_CAPACITY = 5000; private BlockingQueue steps = new ArrayBlockingQueue( @@ -46,13 +44,13 @@ public class ProcessThreadGroup extends ThreadGroup { + " thread group"); this.executionModulesManager = executionModulesManager; this.processThread = processThread; - this.authentication = SecurityContextHolder.getContext() - .getAuthentication(); +// this.authentication = SecurityContextHolder.getContext() +// .getAuthentication(); } - public Authentication getAuthentication() { - return authentication; - } +// public Authentication getAuthentication() { +// return authentication; +// } public void dispatchAddStep(ExecutionStep step) { // legacy diff --git a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/BundlesManager.java b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/BundlesManager.java index c7c4cc1c1..2571efe9d 100644 --- a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/BundlesManager.java +++ b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/BundlesManager.java @@ -49,7 +49,7 @@ public class BundlesManager implements BundleContextAware, FrameworkListener, private BundleContext bundleContext; - private Long defaultTimeout = 120 * 1000l; + private Long defaultTimeout = 30 * 1000l; private Long pollingPeriod = 200l; // Refresh sync objects -- 2.39.2