Skip to content

[Question] how to ensure child threads have same subject as parent thread #2405

@ewesten

Description

@ewesten

Search before asking

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions