.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);
+ }
}
};
}