I am building a multi-tenant application with ASP.NET MVC and have a problem with user validation.
Situation
I have:
- table with user (identifier, name, name, email address) This table is designed so that users registered with two tenants no longer need to log in.
- table with Tentantuser (ID, TenantID, UserID (FK for table user), username, username, password, active) This table contains the password for logging in for one tenant.
Example:
- UserX registered in TenantA and TenantB
- UserX logs on to TenantA, with its username and password for TenantA
- The system checks or the username and password are correct in the TenantUser table
- The system checks UserX which user ID matches the identifier in the table. User
- UserX is sent to TenantB and automatically registered
My problem:
How to create a custom provider so that I can verify the tenant's login and password? For instance:
public abstract bool ValidateUser(string username,string password);
How can I tell my provider which tenant the user is on?
How can I change it like this:
public overrides bool ValidateUser(string username,string password, string tenant); ?
Or what other way to solve this problem?
Masna source share