I'm building a multi-tenant app with ASP.NET MVC and have a problem with validating users.
Situation
I have:
-a table with User(ID, Name, FirstName, Email) This table is made, so that a users who is registered in two tenants doesn't need to login again.
-a table with Tentantuser(ID, TenantID, UserID (FK to table User), UserName, Loginname, Password, Active) This table contains de login en password for one tenant.
Example:
My problem:
How can I create a custom Provider so I can check the login & password in a tenant? For example:
public abstract bool ValidateUser(string username,string password);
How can I say to my provider on which tenant the user is?
How can I change this in something like:
public overrides bool ValidateUser(string username,string password, string tenant); ?
Or what is another way to solve this issue?
The application name parameter can be used to identify tenant a/b, which can be specified in the configuration file. Then, in your custom provider, you can use this to pull the right entry for the tenant. Don't get into setting up custom methods; that would be a pain.
HTH.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With