gitlabhq/omniauth-ldap — pull request #9 by commodo (2014-01-07 08:27:03+00:00)
Title: Added support for authenticating the same username in different subdomains

[ Note that this is related to pull request : https://github.com/intridea/omniauth-ldap/pull/39 Specifically I would be interested in merging this commit https://github.com/commodo/omniauth-ldap/commit/2dfe16d0445d3115d05ba838c5976fe431a713a6 ; the initial fork started from https://github.com/intridea/omniauth-ldap but I am more interested in getting this into Gitlab ]

In case you have a company domain like DC=example,DC=com
And you have multiple subdomains (US, EMEA, AU, etc), and the (company) policy is to define the same username in all subdomains (example user1), then there is a problem when it comes to authenticating user1.

So, a quick fix is to add a user format like subdomain\username, for example

* us\user1 would authenticate on DC=us,DC=example,DC=com
* emea\user1 would authenticate on DC=emea,DC=example,DC=com
* and so on

All you have to do, is to add your base DN as DC=example,DC=com and whenever a user tries to login, he can use the subdomain as a prefix.
This is only needed when the the same username is present in more subdomains.
Otherwise, this works as before.