Hi there Bernd, I think this is more of a Spring Security question... I don't really know if those strategies they provide work in such contexts.
In general you could ask such question on a Spring group and explain that the context needs to survive being used from one thread at a time, but it could be a different one each time. Anything ThreadLocal based generally will not work (in any kind of async toolkits, not just Akka). -- Cheers, Konrad 'ktoso’ Malawski Akka @ Lightbend On 15 March 2016 at 01:21:07, Bernd G. (bernd.go...@gmail.com) wrote: Hello All, we have a small service that implements a REST API, and we use Akka to enable concurrency, for structure and readibility of our code. All works fine, except I'm struggling now with our security integration. We're using Spring as our 'container' framework and Spring Security to handle authentication and authorization. My question now is: How can I use String userId = SecurityContextHolder.getContext().getAuthentication().getName(); in our actors? I know that the Spring security context is by default put into a ThreadLocal. One idea I had is to create an ExecutionContext and pass this to the Actor system create method, thus letting Spring create the threads, and using the security context passing strategy 'MODE_INHERITABLETHREADLOCAL', but I wanted to reach out first if anybody has done this thing already. Thanks in advance! -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout. -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.