Is it possible to use user information to get tenant key?

I’m building a multi-tenant ASP.NET Core (3.1) application, and I must identify the tenant by some information based on the user, like a TenantID linked to the user repository or the own user e-mail domain. I am using a simple Cookie Authentication for that, so I have a cookie in the browser to keep the user logged in.

The point is, the cookie should be prefixed with some tenant information, so that I can have a unique cookie per tenant (what I belive is a good security practice), but how I am supposed to know the correct cookie name if the cookie prefix will be found only after translating the cookie token (across some TENANT claim). Does anyone had some similar situation?

.NET Foundation Website | Blog | Projects | Code of Conduct