Intercept async executor tasks to configure Spring SecurityContext

Hi,
We are embedding the Flowable engine inside an existing Spring Boot app that handles its own security and has a Spring SecurityContext on the thread that processes the HTTP request. However, whenever async tasks are run (e.g. a boundary timer event fires and leads the process into an alternative part of the process flow), we lose that security context, because it’s a different thread. For various reasons, we need to ensure that we always have the SecurityContext configured when a task is run. It’s easy enough to store relevant data from the original context as process variables, but I’m not sure what the best way is to pull these values back out so that we can apply them back onto the running thread’s SecurityContext whenever a task is being run by the async executor. I’ve had a look at both execution listeners and event listeners, but neither seems to do quite what we need, i.e. provide a generic capability (not hard-coded in the process to specific tasks) for hooking into any async task being executed and also give us access to the running process instance.
Any tips or (pseudo) code samples showing the best way to approach this would be much appreciated.
Thanks.