BigW Consortium Gitlab

auth.rb 499 Bytes
Newer Older
1 2
module Gitlab
  class Auth
3
    def find(login, password)
4
      user = User.by_login(login)
5

6 7
      # If no user is found, or it's an LDAP server, try LDAP.
      #   LDAP users are only authenticated via LDAP
8 9
      if user.nil? || user.ldap_user?
        # Second chance - try LDAP authentication
10
        return nil unless Gitlab::LDAP::Config.enabled?
11

12
        Gitlab::LDAP::Authentication.login(login, password)
13 14 15 16
      else
        user if user.valid_password?(password)
      end
    end
17 18
  end
end