简体   繁体   中英

How do I pull information from an LDAP server using JavaScript?

I have the LDAP server hostname and the search base, but have not been able to find any way of using that information with javascript. this is to be used in a windows sidebar gadget.

There is an example in this article that I used from Lothar Haeger's Password Notifier driver for Novell Identity Manager. He has an ECMA implementation of LDAP Search. That is basically what you are looking for, right? In the first link the code is in the article. In the second link, you would have to pick apart the driver XML to get the ECMA out.

Have you tried using LDAP via ActiveX? Something along the lines of:

var ldap = GetObject('LDAP:');
var ad = ldap.OpenDSObject('LDAP://servername:port/o=rootname', 
    'cn=Administrator,ou=Members,o=rootname', 'password', 0);

I adapted this code from the sample on MSDN here: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q328024

The sample is in VBScript but it shouldn't be too tricky to change it to JScript.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM