Skip to content

Instantly share code, notes, and snippets.

@memotype
Created December 6, 2012 20:11
Show Gist options
  • Save memotype/4227899 to your computer and use it in GitHub Desktop.
Save memotype/4227899 to your computer and use it in GitHub Desktop.
*** /home/users/isaac/stuff/graylog2/graylog2-web-interface-0.10.0-rc.1/app/models/ldap_authentication.rb 2012-12-03 11:29:58.000000000 -0500
--- app/models/ldap_authentication.rb 2012-12-06 14:18:39.000000000 -0500
***************
*** 1,6 ****
--- 1,10 ----
+ require "net/ldap/dn"
class LdapAuthentication
def initialize(login, password)
@login = login
+ @login_dn = Net::LDAP::DN.new( ::Configuration.ldap_username_attribute,
+ login,
+ ::Configuration.ldap_base )
@password = password
end
***************
*** 28,33 ****
def session
Net::LDAP.new(:host => ::Configuration.ldap_host,
:port => ::Configuration.ldap_port,
! :auth => { method: :simple, username: @login, password: @password } )
end
end
--- 32,38 ----
def session
Net::LDAP.new(:host => ::Configuration.ldap_host,
:port => ::Configuration.ldap_port,
! :base => ::Configuration.ldap_base,
! :auth => { method: :simple, username: @login_dn, password: @password } )
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment