X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.security.core%2Fsrc%2Forg%2Fargeo%2Fsecurity%2Fcore%2FAbstractSystemExecution.java;h=3acf26c8a1d3097f0336aea0d1c0051556d477dc;hb=d12f4cda6ff7b1de242a19362c3680f30ccc5168;hp=3abc1b48299b74a7e9e26930162b445557658e65;hpb=b3b39d5606a0c48d64a804f4aff5459ea3addc31;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.security.core/src/org/argeo/security/core/AbstractSystemExecution.java b/org.argeo.security.core/src/org/argeo/security/core/AbstractSystemExecution.java index 3abc1b482..3acf26c8a 100644 --- a/org.argeo.security.core/src/org/argeo/security/core/AbstractSystemExecution.java +++ b/org.argeo.security.core/src/org/argeo/security/core/AbstractSystemExecution.java @@ -30,9 +30,10 @@ public abstract class AbstractSystemExecution { // Forces Spring Security to use inheritable strategy // FIXME find a better place for forcing spring security mode // doesn't work for the time being -// if (System.getProperty(SecurityContextHolder.SYSTEM_PROPERTY) == null) -// SecurityContextHolder -// .setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL); + // if (System.getProperty(SecurityContextHolder.SYSTEM_PROPERTY) == + // null) + // SecurityContextHolder + // .setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL); } private final static Log log = LogFactory @@ -72,13 +73,16 @@ public abstract class AbstractSystemExecution { String key = systemAuthenticationKey != null ? systemAuthenticationKey : System.getProperty( - InternalAuthentication.SYSTEM_KEY_PROPERTY, + SystemAuthentication.SYSTEM_KEY_PROPERTY, InternalAuthentication.SYSTEM_KEY_DEFAULT); if (key == null) throw new ArgeoException("No system key defined"); + if (authenticationManager == null) + throw new ArgeoException("Authentication manager cannot be null."); Authentication auth = authenticationManager .authenticate(new InternalAuthentication(key)); securityContext.setAuthentication(auth); + authenticatedBySelf.set(true); if (log.isTraceEnabled()) log.trace("System authenticated"); @@ -112,5 +116,4 @@ public abstract class AbstractSystemExecution { public void setSystemAuthenticationKey(String systemAuthenticationKey) { this.systemAuthenticationKey = systemAuthenticationKey; } - }