I am working on a multi-tenant asp.net core web api. I am using asp.net core identity and identity server 4. I also have a database for each tenant and the idea is to have Identity related tables ( e.g aspnetusers, aspnetroles etc) in the tenant databases.
When a user sends a sign-in request, I use a shared database to look up tenant for that user and then I need to select the tenant database to validate username and password (Using SignInManager)
The problem is I do not know the connection string during Startup.ConfigureServices method.
I am hoping that there is a way to modify connection string much later in the request life cycle ( once I have determined the connection string ) and then have UserStore use that DbContext instead.
Any ideas?