I have a small ruby app in which I'm trying to query some information from Acti开发者_如何学Cve Directory. The app will be run by a Windows user who is already logged in. It looks like the ruby-net-ldap
gem wants me to connect to an LDAP server using an IP address, port and then pass my username and password. Is there a way to achieve this (with a different gem, say) so that I don't have to pass this information (I don't have the current user's password for example, so that's not going to work)?
I'm also hosting a Trac website on our intranet (which is written in Python if I remember correctly and that seems to know the current Windows username and domain. If it can do it, surely my little ruby app can access this information too?
I resolved this by using the win32ole gem. I can now write code like this:
require 'win32ole'
ldap_root = WIN32OLE.connect('LDAP://RootDSE')
精彩评论