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