如何使用 JavaScript 进行 LDAP 查询? [英] How do I do an LDAP query with JavaScript?

查看:45
本文介绍了如何使用 JavaScript 进行 LDAP 查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个具有 LDAP 查询功能的侧边栏小工具,但找不到非常好的或任何有用的文档.我对 Javascript 的经验并不丰富,对 LDAP 查询的功能知之甚少,因此任何信息都会很有用.

I'm trying to make a sidebar gadget that has an LDAP query function but haven't been able to find very good, or any, useful documentation on the matter. I'm not hugely experienced with Javascript and know little to nothing about how LDAP queries function, so any information at all would be useful.

信息:

  • 主持人:a.b.c.d.e
  • 端口:389
  • ou:人
  • o: x_y_z
  • c:我们

第一个片段:

var sSearchURL = "ldap://a.b.c.d.e:389/o=x_y_z,c=us";
var URLsuffix = "dc=" + form.SearchData.value;
document.location = sSearchURL URLsuffix;

其他片段:

var ldap = GetObject('LDAP:');
var ad = ldap.OpenDSObject(
  'LDAP://a.b.c.d.e:389/o=x_y_z',
  'cn=Administrator,ou=People,o=rootname',
  'password',
  0
);

推荐答案

只要你想在网络浏览器中运行你的 JavaScript,你就受限于 HTTP 协议和你的脚本被加载的域.第一名.

As long as you want to run your JavaScript in a web browser, you are limited to the HTTP protocol and to the domain from which your script was loaded in the first place.

因此,无法从 Web 浏览器 JavaScript 引擎与 LDAP 服务器通信.

So, talking to an LDAP server will not be possible from a web browsers JavaScript engine.

有些 JavaScript 运行时环境限制较少,您可以在其中实现套接字服务器和客户端.对于 LDAP 连接,您必须编写自己的库或找到一些现有的库.

There are JavaScript runtime environments that have less limitations where you can implement socket servers and clients. For LDAP conenctivity you'd have to write your own library or find some existing one.

这篇关于如何使用 JavaScript 进行 LDAP 查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆