Reputation: 7204
So I know that in standard vert.x web the request will always be on the same thread even as it goes through async operations, unless you manually spin up a thread. What I'm trying to figure out is if security information can be kept on the thread throughout the life of the request. It doesn't seem like it's possible as seemingly by definition the thread will be reused and could easily have multiple requests interleaved on it, but I wanted to verify in case I was missing something.
My main goal is to have security information available to my domain without forcing everyone to pass it along through the request and possibly mess up, so that brought up this question.
Upvotes: 0
Views: 247
Reputation: 9128
Indeed, you cannot keep security information on the event loop thread, as it will be used to server different users concurrently.
In Vert.x 4, there will be a tracing SPI that brought the concept of local context. I have used it to create a contextual logging library.
It should be possible to propagate security information using the same principle.
Upvotes: 2