It is true that Shiro favors a ThreadLocal-based approach - but that is if you want to use the SecurityUtils static methods that show up all over the place in the
Shiro tutorials. For example, you won't be able to do this:
val subj = SecurityUtils.getSubject() // <- this is relying on ThreadLocal
There is an alternative that will allow you to use Shiro with Spary / Akka: build your own subject using
org.apache.shiro.subject.Subject.Builder and manage its lifecycle in your application code. You won't be able to use the SecurityUtils static methods (which rely on ThreadLocal), but you'll be able to leverage Shiro's Realm infrastructure.
There is still an issues in that if you want to leverage Shiro's Realms for authentication and authorization - you're going to be blocking threads because it does not have an async API. This means that if you wanted to use a reactive persistence layer for your session store (such as ReactiveMongo), you will have to block in your application code when doing auth checks agains the persistence store.
FYI: I've implemented a security layer using Shiro + Spray as a proof of technology and got it working. My opinion, however, is that you are better off building your own simply due to the lack of an async API. If your main concern is password encryption + salting, I have implemented the Shiro flavor in a project I've been working on called Sprest. You can check it out here:
Sprest is not ready for primetime, so please don't consider depending on it. (Besides, there isn't any documentation :)