Return to Snippet

Revision: 10599
at January 5, 2009 10:22 by paramah


Updated Code
require 'rubygems'
require 'net/ldap'

username = ''
password = ''
ldaphost = ''
basedn=''

ldap = Net::LDAP.new(:host => ldaphost, :base => basedn)
filter = Net::LDAP::Filter.eq('uid', username)
ldap.search(:filter => filter) {|entry| username = entry.dn}
ldap.auth(username, password)

if ldap.bind
  print "YEAP";
else
  print "NOPE";
end

Revision: 10598
at January 5, 2009 10:22 by paramah


Initial Code
require 'rubygems'
require 'net/ldap'

username = ''
password = ''
ldaphost = ''
basedn=''

ldap = Net::LDAP.new(:host => ldaphost, :base => basedn)
filter = Net::LDAP::Filter.eq('uid', username)
ldap.search(:filter => filter) {|entry| username = entry.dn}
ldap.auth(username, password)

if ldap.bind
  print "YEAP";
else
  print "NOPE";
end

Initial URL

                                

Initial Description

                                

Initial Title
LDAP access in Ruby

Initial Tags
ruby

Initial Language
Ruby