I've to use the userPrincipalName instead of the default sAMAccountName in all applications which are integrated to AD because we've login-names > 20 characters which isn't supported by sAMAccountName. So i changed

gitlab_rails['ldap_uid'] = 'sAMAccountName'


gitlab_rails['ldap_uid'] = 'userPrincipalName'

in my /etc/gitlab/gitlab.rb config. That's working, but now I need to enter the login-name AND the domain. Example: A User login is called "Peter". With the sAMAccountName I was able to login by enter "Peter" as Username in Gitlab. But because of the userPrincipalName contains the domain, I now have to enter "Peter@mydomain.com".

I'm looking to give my users the comfort to enter only the Loginname, without @domain. Something like this so that the User enter "Peter" and git send "Peter@mydomain.com" to the AD:

 gitlab_rails['ldap_uid'] = '${gitlabUsername}@mydomain.com'

Is this possible?


In your gitlab.rb:

  ## If allow_username_or_email_login is enabled, GitLab will ignore everything
  ## after the first '@' in the LDAP username submitted by the user on login.
  ## Example:
  ## - the user enters 'jane.doe@example.com' and 'p@ssw0rd' as LDAP credentials;
  ## - GitLab queries the LDAP server with 'jane.doe' and 'p@ssw0rd'.
  ## If you are using "uid: 'userPrincipalName'" on ActiveDirectory you need to
  ## disable this setting, because the userPrincipalName contains an '@'.
  allow_username_or_email_login: false

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.