GitHub user ewesten created a discussion: [Question] how to ensure child 
threads have same subject as parent thread

### Search before asking

- [x] I had searched in the [issues, **including closed 
issues**](https://github.com/apache/shiro/issues?q=is%3Aissue) and found no 
similar issues.


### Question

Hello,

with the change from #2082 we are no longer able to run our multi-threading 
model as before so that we could not adopt Shiro 2.0.4 or higher.

Essentially our coding relies so far on the fact that we can obtain the 
principal using

`SecurityUtils.getSubject().getPrincipal()`

also in child threads launched from a parent thread (typically an HTTP request).

I tried following guidance from 
https://shiro.apache.org/subject.html#Subject-ThreadAssociation but without 
success. Even when associating the subject with the Runnable, I am receiving 
`null` for the principal now which used to work prior to 2.0.4.

Is there any guidance / workaround how the user context can be made available 
to child threads?

Regards, Eric



GitHub link: https://github.com/apache/shiro/discussions/2413

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to