KTU
1
Hi
Since there are so many ldap packages there any idea which is the best
one currently ?
I just need to do simple thing. I need to find out common name (cn) by
using ldapsearch
for the ENV variable REMOTE_USER ie. user’s login name.
Any ideas and possible way to do this ?
Thanks
KTU
2
and I dont need to authenticate just anonymous search will do
KTU
3
ok i found simple answer by using ruby net-ldap module
http://rubyforge.org/projects/net-ldap/
require ‘rubygems’
require ‘net/ldap’
ldap = Net::LDAP.new :host => ‘your-host-name-here’,
:port => 389,
:auth => {
:method => :anonymous
}
login = request.env[‘REMOTE_USER’]
filter = Net::LDAP::Filter.eq( “uid”, login )
treebase = “ou=company,ou=people,o=us”
ldap.search( :base => treebase, :filter => filter ) do |entry|
@fullname = entry[:cn]