Skip to content

Cloning a repository over HTTPS with LDAP credentials causes a HTTP 401 Access denied

Summary

Cloning a repository over HTTPS with LDAP credentials prints the error 401 HTTP Basic: Access denied.

Steps to reproduce

  1. Enable LDAP and add a server
  2. Setup a user with username != LDAP login (this is important)
  3. Create a private repository (so cloning requires credentials)
  4. Try to clone the repo over https using LDAP credentials
  5. Error: 401 HTTP Basic: Access denied

What is the current bug behavior?

Gitlab returns a HTTP 401.

What is the expected correct behavior?

The repository should be cloned.

Possible fixes

/lib/gitlab/auth.rb, line 72

The problem is that Gitlab::Auth.find_with_user_password(login, password) correctly verifies the provided credentials, but fails to return an actual user. A merge request will be provided.