Skip to content

Instantly share code, notes, and snippets.

@pkmishra
Created October 30, 2015 21:12
Show Gist options
  • Save pkmishra/658a68a95e1b8447a2b1 to your computer and use it in GitHub Desktop.
Save pkmishra/658a68a95e1b8447a2b1 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'net/ldap'
time = Time.new
p time.localtime
ldap = Net::LDAP.new :host => '<hostname>',
:port => 636,
:auth => {
:method => :simple,
:username => '<username>',
:password => '<password>'
},
:encryption => {:method => :simple_tls}
time1 = Time.new
p time1.localtime
if ldap.bind
p " authentication succeeded "
time2 = Time.new
p time2.localtime
else
p " authentication failed "
p ldap.get_operation_result
time3 = Time.new
p time3.localtime
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment