Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SERVER = 'ad01.company.com' # Active Directory server name or IP
- PORT = 389 # Active Directory server port (default 389)
- BASE = 'DC=company,DC=com' # Base to search from
- DOMAIN = 'company.com' # For simplified user@domain format login
- ### END CONFIGURATION ###
- def self.authenticate(login, pass)
- return false if login.empty? or pass.empty?
- conn = Net::LDAP.new :host => SERVER,
- :port => PORT,
- :base => BASE,
- :auth => { :username => "#{login}@#{DOMAIN}",
- :password => pass,
- :method => :simple }
Advertisement
Add Comment
Please, Sign In to add comment