When using LDAP current user in HTTPS Clone URL is wrong (in some cases)
Summary
When using LDAP / Active Directory authentifcation and login name differs from username, the default URL which is displayed for each Repo is built wrong. username is showing in the URL, but in my case you need a login name to login. When the login name contains an @ like userPrincipalName does, the URL is not valid.
This feature was added in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9347 but does not work correctly in LDAP environments.
Steps to reproduce
- Integrate Gitlab into LDAP / Active Directory
- Choose login name (uid) that is different from username
- Read default https URL to clone a repository (https://username@gitlabexample.com/User/Project.git)
Example-Configuration: (userPrincipalName is something like username@example.com)
main: # 'main' is the GitLab 'provider ID' of this LDAP server label: 'LDAP' host: 'XXX' port: 3268 uid: 'userPrincipalName' method: 'plain' # "tls" or "ssl" or "plain" bind_dn: 'XXX' password: 'XXX' active_directory: true allow_username_or_email_login: false block_auto_created_users: false base: 'XXX' user_filter: '' attributes: username: ['uid', 'userid', 'sAMAccountName'] email: ['mail', 'email', 'userPrincipalName'] name: 'cn' first_name: 'givenName' last_name: 'sn'
Possible fixes
Please make the default URL with the username included optional.