ldap

74 views
Skip to first unread message

Paulo Carvalho

unread,
Oct 24, 2007, 9:57:33 AM10/24/07
to rubyonra...@googlegroups.com
Hello

I have an application that is working.
Now i want to have a login page to make the authentication using ldap.
How can i do that with rails?
What is the best library/extension to do that?

Thanks
regards
--
Posted via http://www.ruby-forum.com/.

Jamey Cribbs

unread,
Oct 24, 2007, 10:01:14 AM10/24/07
to rubyonra...@googlegroups.com
Ruby's net_ldap library works great for this.

Paulo Carvalho

unread,
Oct 24, 2007, 10:04:57 AM10/24/07
to rubyonra...@googlegroups.com
I found it but it doens not have any information.

Could you tell me how can I install and use it?

Jamey Cribbs wrote:
> Ruby's net_ldap library works great for this.

--
Posted via http://www.ruby-forum.com/.

Jamey Cribbs

unread,
Oct 24, 2007, 10:14:29 AM10/24/07
to rubyonra...@googlegroups.com
IIRC, you can do a gem install ruby_net_ldap.  Google for something like "rails ldap authenticate" and you should be able to find examples of using it.  Basically, you can just call it's bind method and if that is successful, you know that you have authenticated.


On 10/24/07, Paulo Carvalho <rails-mai...@andreas-s.net> wrote:

Paulo Carvalho

unread,
Oct 24, 2007, 10:23:52 AM10/24/07
to rubyonra...@googlegroups.com
Thank you

Ive just installed it and i am gonna to try now.

regards

Jamey Cribbs wrote:
> IIRC, you can do a gem install ruby_net_ldap. Google for something like
> "rails ldap authenticate" and you should be able to find examples of
> using
> it. Basically, you can just call it's bind method and if that is
> successful, you know that you have authenticated.

--
Posted via http://www.ruby-forum.com/.

Cynthia Kiser

unread,
Dec 18, 2007, 8:22:06 PM12/18/07
to rubyonra...@googlegroups.com
A bit late, but for those who might search the archives, I like acts_as_ldap_authenticated (for my rails 1.2.6 site) http://www.noitulove.ch/ldap-authentication-plugin-for-rails/ As the post indicates, it is largely a drop in replacement for the acts_as_authenticated plugin.

But if you also use Oracle, there is a library conflict. See this for the work around (require 'ldap' before the rails boot line in environment.rb) http://lists.rubyonrails.org/pipermail/rails/2006-April/032583.html
--
Cynthia Kiser
cynthi...@gmail.com

scootiePuff

unread,
Jan 16, 2008, 3:10:05 PM1/16/08
to Ruby on Rails: Talk
from this page,
http://wiki.rubyonrails.org/rails/pages/ldap

i see that there are at least three different ways for rails to
implement ldap:

* Net-LDAP - Pure Ruby LDAP API
* Ruby/LDAP - Interface to some common LDAP libraries
* ActiveLDAP - the ActiveRecord way

-what are some advantages of each over the others? disadvantages?
-comparative ease of use in setting up and maintenance? finding
resources on the net and books?
-what factors contributed in your choice of which implementation to go
with?

it seems from some postings in this group that folks seem to recommend
either net_ldap and/or activeldap for ldap authentication with rails.
why?

thank you.


> From: "Jamey Cribbs" <jcri...@netpromi.com>
> Date: Wed, 24 Oct 2007 10:01:14 -0400
> Local: Wed, Oct 24 2007 6:01 am

> Ruby's net_ldap library works great for this.

George Bray

unread,
Jan 16, 2008, 5:15:52 PM1/16/08
to rubyonra...@googlegroups.com
I've just used Net-LDAP, but not before wasting lots of time trying to
get ActiveLDAP working. For me, a relatively new RoR user, I never
found a single place with complete documentation on how to set it up
in a Rails app. The docs for Net-LDAP had the best examples for me, as
I'm only after simple auth. I don't need a full OO API to build a dir
management system which ActiveLDAP promises.

<http://rubyfurnace.com/docs/ruby-net-ldap-0.0.4/>
<http://wiki.rubyonrails.org/rails/pages/HowtoAuthenticateWithRubyNetLdap>
<http://www.rich-waters.com/blog/2007/02/using-domino-logins-ldap-for-a-ruby-on-rails-app.html>

Hal Fulton's (great) book The Ruby Way has a page on interfacing to
LDAP - I took his advice and investigated all of them to form my own
opinion. Hal also mentions acts_as_authenticated in The Rails Way
(also great) which gave me clues for where the code goes in my app.

George

--
George Bray, The Australian National University, Canberra, Australia.

Craig White

unread,
Jan 16, 2008, 5:18:17 PM1/16/08
to rubyonra...@googlegroups.com

On Wed, 2008-01-16 at 12:10 -0800, scootiePuff wrote:
> from this page,
> http://wiki.rubyonrails.org/rails/pages/ldap
>
> i see that there are at least three different ways for rails to
> implement ldap:
>
> * Net-LDAP - Pure Ruby LDAP API
> * Ruby/LDAP - Interface to some common LDAP libraries
> * ActiveLDAP - the ActiveRecord way
>
> -what are some advantages of each over the others? disadvantages?
> -comparative ease of use in setting up and maintenance? finding
> resources on the net and books?
> -what factors contributed in your choice of which implementation to go
> with?
>
> it seems from some postings in this group that folks seem to recommend
> either net_ldap and/or activeldap for ldap authentication with rails.
> why?
>
----
I don't know, I use ruby/LDAP for authentication. It was the first/easiest method I got to work, it's part of rpmforge packages so it installs easy on RHEL/CentOS/Fedora and it has just worked.

Craig

George Bray

unread,
Jan 16, 2008, 10:41:50 PM1/16/08
to rubyonra...@googlegroups.com
Oops, of course The Rails Way is by Obie Fernandez. A great reference.

CNK

unread,
Feb 11, 2008, 10:43:14 PM2/11/08
to Ruby on Rails: Talk
> i see that there are at least three different ways for rails to
> implement ldap:
>
> * Net-LDAP - Pure Ruby LDAP API
> * Ruby/LDAP - Interface to some common LDAP libraries
> * ActiveLDAP - the ActiveRecord way
>
> -what are some advantages of each over the others? disadvantages?

ActiveLDAP is higher level - it depends on Ruby/LDAP for the low level
LDAP interactions and then builds a ruby object corresponding to your
LDAP object. If you want to display your LDAP information on your
Rails-based web site, it is the way to go. If you are just going to
use LDAP for authenticating users, it is overkill.

As I mentioned previously, if your site is Rails 1.x,
acts_as_ldap_authenticated was a drop in replacement for
acts_as_authenticated. I don't know how much fiddling it will take to
get that plugin to work in Rails 2.0, but I will probably find out in
the next 2-3 months when I convert some sites.
Reply all
Reply to author
Forward
0 new messages