Reg: JRUBY to LDAP

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Reg: JRUBY to LDAP

Sathya Prakash
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 the flow. As i am from JAVA background.

--
Regards,
Prakash.
Reply | Threaded
Open this post in threaded view
|

Re: Reg: JRUBY to LDAP

keithrbennett
Sathya -

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


There’s 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 that…and even if you don’t already use a Java library for this, it might be worth looking into…it might be better quality than the Ruby gem (I don’t know, I’m just raising the possibility).

- Keith


On Feb 3, 2014, at 8:54 AM, Sathya Prakash <[hidden email]> wrote:

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 the flow. As i am from JAVA background.

--
Regards,
Prakash.

Reply | Threaded
Open this post in threaded view
|

Re: Reg: JRUBY to LDAP

Sathya Prakash
Thanks Keith for responding to my post!!

Jruby ldap is available.Googled and found many pages but i am looking for 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 dates i.e., 5 years now.


Regards,
Sathya Prakash.




On Mon, Feb 3, 2014 at 8:09 PM, Keith Bennett <[hidden email]> wrote:
Sathya -

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


There’s 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 that…and even if you don’t already use a Java library for this, it might be worth looking into…it might be better quality than the Ruby gem (I don’t know, I’m just raising the possibility).

- Keith

---
Keith R. Bennett

On Feb 3, 2014, at 8:54 AM, Sathya Prakash <[hidden email]> wrote:

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 the flow. As i am from JAVA background.

--
Regards,
Prakash.




--
Regards,
Prakash.
Reply | Threaded
Open this post in threaded view
|

Re: Reg: JRUBY to LDAP

Doug Hathaway
Sathya,
  The gem that Keith referenced has its own mailing list, perhaps that would be a better source for example code?



On Mon, Feb 3, 2014 at 9:56 AM, Sathya Prakash <[hidden email]> wrote:
Thanks Keith for responding to my post!!

Jruby ldap is available.Googled and found many pages but i am looking for 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 dates i.e., 5 years now.


Regards,
Sathya Prakash.




On Mon, Feb 3, 2014 at 8:09 PM, Keith Bennett <[hidden email]> wrote:
Sathya -

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


There’s 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 that…and even if you don’t already use a Java library for this, it might be worth looking into…it might be better quality than the Ruby gem (I don’t know, I’m just raising the possibility).

- Keith

---
Keith R. Bennett

On Feb 3, 2014, at 8:54 AM, Sathya Prakash <[hidden email]> wrote:

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 the flow. As i am from JAVA background.

--
Regards,
Prakash.




--
Regards,
Prakash.



--
Doug Hathaway

Reply | Threaded
Open this post in threaded view
|

Re: Reg: JRUBY to LDAP

christian
maybe you find that old project of mine useful https://github.com/mkristian/dm-ldap-adapter

- christian
Reply | Threaded
Open this post in threaded view
|

Re: Reg: JRUBY to LDAP

Sathya Prakash
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 ::
Filter.java:330:in `encodeSimpleFilter': javax.naming.directory.InvalidSearchFilterException: Missing 'equals';
        from Filter.java:171:in `encodeFilter'
        from Filter.java:74:in `encodeFilterString'
        from LdapClient.java:547:in `search'
        from LdapCtx.java:1985:in `doSearch'
        from LdapCtx.java:1847:in `searchAux'
        from LdapCtx.java:1772:in `c_search'

Code/Program :

require 'ldap'
class LDAPCheck
def authenticate
     puts "Step 1"
 
# LDAP Details

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 details for secuirty purpose

ldap_filter='(objectclass=sathya)'
ldap_attrs=nil             
scope = LDAP::LDAP_SCOPE_SUBTREE
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')}"
end

puts "Step 2"

puts "I am trying to connect to #{ldap_host} :::port  #{ldap_port}"
ldap_conn = LDAP::Conn.new(ldap_host, 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| 
     conn.search(ldap_base1_dn, LDAP::LDAP_SCOPE_SUBTREE, "*.com",["name","mail"]) do |entry|
        puts "#{entry.inspect}"
     end
  end    
      
 
end
end
check = LDAPCheck.new 

puts "#{check.authenticate}"


On Mon, Feb 3, 2014 at 9:30 PM, christian <[hidden email]> wrote:
maybe you find that old project of mine useful https://github.com/mkristian/dm-ldap-adapter

- christian



--
Regards,
Prakash.