Add more LDAP Debug logs

[ci skip]
pull/4455/head
Oliver Günther 9 years ago
parent b0844578ee
commit ece1de3e64
  1. 4
      app/models/auth_source.rb
  2. 7
      app/models/ldap_auth_source.rb

@ -69,10 +69,10 @@ class AuthSource < ActiveRecord::Base
def self.authenticate(login, password)
AuthSource.where(['onthefly_register=?', true]).each do |source|
begin
logger.debug "Authenticating '#{login}' against '#{source.name}'" if logger && logger.debug?
Rails.logger.debug { "Authenticating '#{login}' against '#{source.name}'" }
attrs = source.authenticate(login, password)
rescue => e
logger.error "Error during authentication: #{e.message}"
Rails.logger.error "Error during authentication: #{e.message}"
attrs = nil
end
return attrs if attrs

@ -44,7 +44,7 @@ class LdapAuthSource < AuthSource
attrs = get_user_dn(login)
if attrs && attrs[:dn] && authenticate_dn(attrs[:dn], password)
logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
Rails.logger.debug { "Authentication successful for '#{login}'" }
return attrs.except(:dn)
end
rescue Net::LDAP::LdapError => error
@ -115,6 +115,9 @@ class LdapAuthSource < AuthSource
object_filter = Net::LDAP::Filter.eq('objectClass', '*')
attrs = {}
Rails.logger.debug {
"LDAP initializing search (BASE=#{base_dn}), (FILTER=#{(object_filter & login_filter).to_s})"
}
ldap_con.search(base: base_dn,
filter: object_filter & login_filter,
attributes: search_attributes) do |entry|
@ -124,7 +127,7 @@ class LdapAuthSource < AuthSource
attrs = { dn: entry.dn }
end
logger.debug "DN found for #{login}: #{attrs[:dn]}" if logger && logger.debug?
Rails.logger.debug { "DN found for #{login}: #{attrs[:dn]}" }
end
attrs

Loading…
Cancel
Save