Multi tenant membership provider ASP.NET MVC
- by Masna
Hello,
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:
UserX is registered in TenantA and TenantB
UserX logs in on TenantA, with his login and password for TenantA
System verifies or login and password are correct in the table TenantUser
System validates UserX which userID corresponds to the Id in the table User
UserX goes to TenantB and is automatically logged in
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?