Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'net/ldap'
- def authenticate(user_name, password)
- conn = Net::LDAP.new( {:host => '192.168.1.100', :port => 389, :auth => { :method => :simple, :username => user_name, :password => password }} )
- conn.bind
- end
- # puts "Yay" if authenticate('Mary', 'Frank3nstein')
- # => "Yay"
- # authenticate('Baduser', 'Bad pass')
- # => false
Add Comment
Please, Sign In to add comment