Created
October 30, 2015 21:12
-
-
Save pkmishra/658a68a95e1b8447a2b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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