diff --git a/lib/ldap_login/login.rb b/lib/ldap_login/login.rb index f902a82..b686f65 100644 --- a/lib/ldap_login/login.rb +++ b/lib/ldap_login/login.rb @@ -8,13 +8,16 @@ module LdapLogin::Login login_flag = false url = '/' url_method = 'redirect_to' - + uri = URI(LDAP_ADSERVER) req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json') req.body = {AppKey: AppKey,username: ldap_user,password: ldap_pass}.to_json - res = Net::HTTP.start(uri.hostname, uri.port) do |http| - http.request(req) - end + req.read_timeout = 3000 + + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_NONE + res = http.request(req) if res.code == '200' && JSON.load(res.body)["userID"]==ldap_user if !user.nil?