So, IResourceOwnerPasswordValidator is supposed to replace IUserService. In the old version IdentityServer3 I could do the following:
factory.UserService = new Registration<IUserService>(typeof(MyIdentityUserService));
factory.Register(new Registration<IUserRepository>(userRepository));
which passes a custom userRepository object with the proper connection string. Now in IdentityServer4 I need to Connect to the proper Portal database in order for ID4 to authenticate the user against the correct portal database.
If I could pass a parameter to the constructor of the ResourceOwnerPasswordValidator class like below , then this would be fine but this is not possible with ASP.NET CORE.
public ResourceOwnerPasswordValidator(string MyConnString)
{
_connstring = MyConnString;
}
This can't work because the ConfigurationService registers this class without the ability to pass values. This makes sense since this registration process begins before the pipeline is built. How do I dynamically pass a connection string to the ResourceOwnerPasswordValidator class? I am trying to authenticate against the portal making the call. In ID3 I could do this by using the acr_value.
I am trying to get ID4 to authenticate as a MultiTenant Authentication Server.