X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=security%2Fruntime%2Forg.argeo.security.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fsecurity%2Fcore%2FKeyBasedSystemExecutionService.java;h=01d760f12befc1ce88fa38eb37c4d308505c6a49;hb=802beab5459c8da4970215886babb45d968e4639;hp=2fc4388afbca2de6411e400bc7303ad2248caf38;hpb=3cd76e9fb547b4e839931c96264f0edc3ec315b6;p=lgpl%2Fargeo-commons.git diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/KeyBasedSystemExecutionService.java b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/KeyBasedSystemExecutionService.java index 2fc4388af..01d760f12 100644 --- a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/KeyBasedSystemExecutionService.java +++ b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/core/KeyBasedSystemExecutionService.java @@ -39,11 +39,12 @@ public class KeyBasedSystemExecutionService implements SystemExecutionService { .authenticate(new InternalAuthentication( systemAuthenticationKey)); securityContext.setAuthentication(auth); - - runnable.run(); - - // remove the authentication - securityContext.setAuthentication(null); + try { + runnable.run(); + } finally { + // remove the authentication + securityContext.setAuthentication(null); + } } }; }