diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-09-02 23:50:45 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-09-02 23:50:45 +0300 |
commit | 71abf70458ca1f6d85bc828b215931eaf3639b5d (patch) | |
tree | 900970ee4eab7c79cfa1fb33fee015d3b116950f /lib/gitlab/auth.rb | |
parent | 6bf117c601eda2ae3045644ab778d167955cd0c3 (diff) | |
download | gitlab-ce-71abf70458ca1f6d85bc828b215931eaf3639b5d.tar.gz |
Move ldap auth to LDAP::User. Removed unused code
Diffstat (limited to 'lib/gitlab/auth.rb')
-rw-r--r-- | lib/gitlab/auth.rb | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 5f4b6c22c2c..34e25bc9ccb 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -66,23 +66,12 @@ module Gitlab Gitlab::AppLogger end - def ldap_auth(login, password) - # Check user against LDAP backend if user is not authenticated - # Only check with valid login and password to prevent anonymous bind results - return nil unless ldap_conf.enabled && !login.blank? && !password.blank? - - ldap = OmniAuth::LDAP::Adaptor.new(ldap_conf) - ldap_user = ldap.bind_as( - filter: Net::LDAP::Filter.eq(ldap.uid, login), - size: 1, - password: password - ) - - User.find_by_extern_uid_and_provider(ldap_user.dn, 'ldap') if ldap_user - end - def ldap_conf @ldap_conf ||= Gitlab.config.ldap end + + def ldap_auth(login, password) + Gitlab::LDAP::User.auth(login, password) + end end end |