Forum: JRuby Reg: JRUBY to LDAP

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
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.
0d1cd73bfe0ebe09074bfcd138ed3d5d?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
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.
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
christian (Guest)
on 2014-02-03 17:01
(Received via mailing list)
maybe you find that old project of mine useful

- christian
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}"
This topic is locked and can not be replied to.