I am creating a web service using Spray.io, which sits on top of the main application created with Akka.
When I receive a request, it is processed by a spray route, which in turn sends (using the request) the request to the subject who processes the request and returns a response using the request context.
I authenticate and authorize the user on the initial route, and this authentication / authorization returns a user object containing user data.
I need to have access to this user object in the main Akka application at different points. I donβt want to pass it as a parameter for every message (case class) sent to the actor, because it just seems messy, because sometimes I passed it to the actor so that it could be passed to another, Is there a better / recommended way to make this object available to other participants in the system? Can it be tied to the request context itself or is it bad practice?
thanks
source share