Skip to content

Bug: LDAP login broken for users with 2FA enabled

Summary

Since 8.4 our users that have 2FA enabled can't login using their LDAP account. SAML login still works for those same users.

Steps to reproduce

  • Enable 2FA authentication for an LDAP user

  • Try to login, using the LDAP account

  • Login fails: Could not authenticate you from Ldapmain because "Undefined method `avatar url' for #<gitlab::ldap::user:0x007f80253c03f0>".

  • Disable 2FA for this user

  • Try to log in agan

  • Login succeeds

Expected behavior

Second factor is requested, and login succeeds.

Relevant logs and/or screenshots

==> /data/git/gitlab/log/production.log <==
Started POST "/users/auth/ldapmain/callback" for 127.0.0.1 at 2016-01-25 13:29:11 +0100

==> /data/git/gitlab/log/unicorn.stdout.log <==
I, [2016-01-25T13:29:11.641871 #21042]  INFO -- omniauth: (ldapmain) Callback phase initiated.

==> /data/git/gitlab/log/production.log <==
Processing by OmniauthCallbacksController#ldapmain as HTML
  Parameters: {"utf8"=>"â", "authenticity_token"=>"[FILTERED]", "username"=>"boudekerk", "password"=>"[FILTERED]", "remember_me"=>"1"}
Completed 500 Internal Server Error in 234ms (ActiveRecord: 34.7ms)

==> /data/git/gitlab/log/unicorn.stdout.log <==
E, [2016-01-25T13:29:11.899675 #21042] ERROR -- omniauth: (ldapmain) Authentication failure! ldap_error: ActionView::Template::Error, undefined method `avatar_url' for #<Gitlab::LDAP::User:0x007f80243bff00>