Two users with the same Username from different tenants

Two users with the same Username from different tenants

  
Hi,

I'm using the Users user provider. Let's assume that there are two users, with the same Username but in two different tenants. Let's assume also, that I know which tenant is to be used. The question is: how can I force Users (I mean: the provider, not the application) to select and check the appropriate user?
Some example to be clearer:
- there is a user "AUser" in the tenant "Users"
- there is also a user "AUser" in some other tenant "SomeTenant"
My application accepts users from SomeTenant. When the user enters his login and password:
- I switch the tenant to SomeTenant, using TenantSwitch
- I try to login the users using the User_Login action
User_Login seems to check just the first "AUser" it finds. In some cases it is the user from SomeTenant, in other cases  - from Users.
And it is just them same, when I try to login AUser in the Users application.

What could be the solution?

Regards
Tomasz
Greetings,

You'll need to implement your own login logic, instead of using the action from users. It should be fairly simple:
  1. Switch to the target tenant
  2. Query the Users entity to validate the inserted credentials
  3. Use the Login action from System to login, if the credentials are correct

João Pedro Abreu wrote:
Greetings,

You'll need to implement your own login logic, instead of using the action from users. It should be fairly simple:
  1. Switch to the target tenant
  2. Query the Users entity to validate the inserted credentials
  3. Use the Login action from System to login, if the credentials are correct
 Well, I can use LoginPassword also. But there are still 2 questions:
  • how LoginPassword works in the context of the integration with AD?
  • how can "AUser" login to the Users application ?

Regards
Tomasz

 

Tomasz M. Lipinski wrote:
 Well, I can use LoginPassword also. But there are still 2 questions:
  • how LoginPassword works in the context of the integration with AD?
  • how can "AUser" login to the Users application ?
As far as I can tell, when you are authentication against an external user provider, such as AD, you should use Login and not LoginPassword. Login password will validate the user's local password.

In order to login to the Users application, "AUser" should use a login screen that forces a tenant switch to the Users tenant. I don't think its original login was designed to allow many users with the same username.

Now that i think of it, all the multi-tenant applications I've seen so far had their own user provider and that's probably why!
 
João Pedro Abreu wrote:

As far as I can tell, when you are authentication against an external user provider, such as AD, you should use Login and not LoginPassword. Login password will validate the user's local password.
OK, Login, but together with some action that asks AD to check the password.

In order to login to the Users application, "AUser" should use a login screen that forces a tenant switch to the Users tenant. I don't think its original login was designed to allow many users with the same username.
My experiments say, that Users application just doesn't work with multiple usernames.

Now that i think of it, all the multi-tenant applications I've seen so far had their own user provider and that's probably why!
 
 I think that it is the key answer :-)

Thanks for all.

Regards
Tomasz