Guest User

Untitled

a guest
Mar 8th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. require 'rubygems'
  2. require 'net/ldap'
  3.  
  4.  
  5. def authenticate(user_name, password)
  6. conn = Net::LDAP.new( {:host => '192.168.1.100', :port => 389, :auth => { :method => :simple, :username => user_name, :password => password }} )
  7. conn.bind
  8. end
  9.  
  10. # puts "Yay" if authenticate('Mary', 'Frank3nstein')
  11. # => "Yay"
  12. # authenticate('Baduser', 'Bad pass')
  13. # => false
Add Comment
Please, Sign In to add comment