With WebSecurity, Registering a user is like this:
WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
I know I can pass in custom parameters for my User table as well. What I'm wondering is - in a multi-tenant scenario, how do I allow WebSecurity to enforce uniqueness on Username and TenantId columns, instead of just Username?
Related - when logging in, how do I specify a `TenantId' so that forms auth assigns a cookie only if the user exists on the specified tenant?
Unfortunately I can only extend WebSecurity and don't have the option to replace it. Hopefully there's a way to make this work.
We've solved this problem in the past by just adding a tenant identifier to the username when saving the user and again when verifying the login credentials.
The user doesn't see this, but it works brilliantly and easily!