Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
require 'sinatra'
require 'net/ldap'
ldap = = ''
ldap.port = 389
ldap.auth "username", "password"
filter = Net::LDAP::Filter.eq('CN', 'john ivanoff')
treebase = "dc=reputablecompany, dc=com" => treebase, :filter => filter) do |entry|
puts "DN: #{entry.dn}"
entry.each do |attribute, values|
puts " #{attribute}:"
values.each do |value|
puts " --->#{value}"
p ldap.get_operation_result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment