views:

185

answers:

1

I'm trying to connect to an existing LDAP server to authenticate users trying to use my app – I'm having trouble figuring out where to start.

I've read about LDAP, understand how it works, and have looks at libs like ActiveLdap.

I'm just not sure where to start from here: I have the hostname of the server I was to authenticate against (bind with), but I don't know how to go about doing it.

(The answers on SO are quite, quite old, and links are broken!)

Thanks!

+1  A: 

You will need, in addition to the hostname (and port, if non-standard), a DN to authenticate against (look at it as the DN identifying your "user", e.g. cn=BillG,ou=engineering,o=microsoft) as well as the corresponding password.

See LDAP::Conn.bind (assuming not using SSL, in which case you'd use LDAP::SSLConn); please read through this tutorial for full examples.

vladr
That tutorial is great – I'll be checking that out later. Also, I'd never looked at the username/DN meshing in the way you point out 'look at it as the DN identifying your "user". Thank you! I'll accept this after I check that it works, if that's fair :)
Isaac Hodes
Though I wasn't able to solve the problem this way (auth issues are probably what is standing in my way) I'll accept it by default. It should be useful for people reading this in the future.
Isaac Hodes