LDAP and Ruby on Rails
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!
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.
精彩评论