Forum: JRuby Reg: JRUBY to LDAP

6255b889d53f114e9a012375f9becd53?d=identicon&s=25 Sathya Prakash (Guest)
on 2014-02-03 14:55
(Received via mailing list)
Hi ,

I am new to JRUBY.

I would like to connect with LDAP to check user status.

Can Someone help with code and steps to execute.

I have installed JRUBY and ran a sample program. Try to understanding
flow. As i am from JAVA background.
486ca04f06d968004643ce5b47376ded?d=identicon&s=25 Keith B. (keith_b)
on 2014-02-03 15:40
(Received via mailing list)
Sathya -

I have no experience with this, but I just googled ruby ldap and got
some hits.  Ruby Toolbox was one of them; its a helpful site, with
information and ratings on gems.  Here is a page that might help:

Theres one (net-ldap) that is the overwhelming favorite there.

Aside from that, if you already use a Java library for this, you could
always use thatand even if you dont already use a Java library for this,
it might be worth looking intoit might be better quality than the Ruby
gem (I dont know, Im just raising the possibility).

- Keith

Keith R. Bennett
6255b889d53f114e9a012375f9becd53?d=identicon&s=25 Sathya Prakash (Guest)
on 2014-02-03 15:58
(Received via mailing list)
Thanks Keith for responding to my post!!

Jruby ldap is available.Googled and found many pages but i am looking
exist steps..

If anybody has used jruby ldap. Kindly Guide me.

I can see in the mailing list there are some post in archive with old
i.e., 5 years now.

Sathya Prakash.
A8f7c2b66fafa83e9537c1f82348f11d?d=identicon&s=25 Doug Hathaway (Guest)
on 2014-02-03 16:42
(Received via mailing list)
  The gem that Keith referenced has its own mailing list, perhaps that
would be a better source for example code?

*List: *!forum/ruby-ldap
B05d3cbc64b0031a24c2887fb6ddc173?d=identicon&s=25 christian (Guest)
on 2014-02-03 17:01
(Received via mailing list)
maybe you find that old project of mine useful

- christian
6255b889d53f114e9a012375f9becd53?d=identicon&s=25 Sathya Prakash (Guest)
on 2014-02-06 10:43
(Received via mailing list)
Please find the below code in ruby.. I am getting below error.

I have established  ldap connection because i did not got any error
regarding the connection.

Any one help in setting parameter to search and employee by email/ name.

*Error Message ::* `encodeSimpleFilter': Missing 'equals';
        from `encodeFilter'
        from `encodeFilterString'
        from `search'
        from `doSearch'
        from `searchAux'
        from `c_search'

*Code/Program :*

require 'ldap'
class LDAPCheck
def authenticate
      puts "Step 1"

# LDAP Details

ldap_host = ''
ldap_port =389
ldap_base_dn = 'CN=Sathya Prakash Mullangi
chenchu,OU=Users,OU=Bangalore' #
remove few details for secuirty purpose
 ldap_base1_dn = 'CN=Prakash ,OU=Users,OU=Bangalore' # remove few
for secuirty purpose

filter = '(objectclass=)'
attrs = ['sn', 'cn']

def print_entry(entry)
  puts "IN Enter section"
  puts "#{entry.vals('uid')},#{entry.vals('givenName')},
#{entry.vals('sn')}, # {entry.vals('mail')}"

 puts "Step 2"

puts "I am trying to connect to #{ldap_host} :::port  #{ldap_port}"
ldap_conn =, ldap_port)
 ldap_conn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )

puts "ldap connection :::#{ldap_conn}"
  ldap_conn.bind(ldap_base_dn, 'My Password')  do |conn|, LDAP::LDAP_SCOPE_SUBTREE,
"*.com",["name","mail"]) do |entry|
        puts "#{entry.inspect}"

check =

puts "#{check.authenticate}"
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.