问题标签 [ldapjs]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
154 浏览

active-directory - 未正确处理 ldapjs 客户端 API 中无效过滤器值的错误

传递不正确的过滤器数据时,ldapjs 客户端 API 未引发正确的错误。

下面是代码片段:

在这里,我们传递了错误的过滤器参数。

在这里,它不会从 ldapjs 错误http://ldapjs.org/errors.html引发任何错误。似乎错误处理没有正确实施。

0 投票
1 回答
1223 浏览

javascript - ldapjs 无法连接服务器

所以我只想创建一个到我的 LDAP 服务器的连接:

但无论我为 url 输入什么:

与 Apache Direct Studio 连接工作正常。我还会收到运行时警告:

有没有人修复这个错误?

0 投票
1 回答
27 浏览

node.js - Feathersjs 验证方法使用 ldapjs 模块问题

我想编写一个函数,在检查与服务器的绑定是否正确之后添加 ldap 服务器的参数,否则数据将不会添加到 db 中;我必须使用羽毛 js。在将参数添加到数据库之前,我尝试写几行来验证参数: const ldap=require("ldapjs"); 但问题是,当我在 ldap.bind 函数内部和外部执行 console.log(errors) 时:我注意到结果仅在函数内部可见,而对其余代码不可见!我需要它对其他部分也可见,以便我可以使用它,我想知道如何解决这个问题。

这是代码以及 console.log 的结果。

0 投票
1 回答
333 浏览

active-directory - ldap 查询以搜索用户和组

我正在尝试使用 ldapjs 节点库来搜索组内的用户,但这似乎不起作用。这是 ldap 属性:

我正在尝试搜索 sAMAccountName 为“toma”并且是 memberOf 组“g.some_group”的用户。

为此,我编写了此查询:

这不会产生任何结果。这只是打印:

status: {"messageID":2,"protocolOp":"LDAPResult","status":0,"matchedDN":"","errorMessage":"","referrals":[],"controls":[]}

我的查询似乎有一些错误:

任何人都可以在这里帮助我。

0 投票
0 回答
303 浏览

node.js - How do you update a thumbnailPhoto in Active Directory using NodeJS and ldapjs?

I'm new to working with Active Directory in general. I'm trying to update the thumbnailPhoto attribute using ldapjs npm package I have my code setup to be able to update attributes in general and it works well.

I get my user like so:

I call my modifyUser method from my LDAP class like so:

modifyUser:

When I update the photo using my LDAP Tool it converts it to what i believe to be an octet or some sort of hex value. How do i mimic that in nodejs?

Am I on the right track? All other attributes get updated instantly using the code above, but the image fails to update...

Also is there a way to update multiple attributes at once? I get the error that only one attribute can be modified at a time.

Thanks in advance for your time!

0 投票
1 回答
143 浏览

openldap - 为 ldapjs 服务器端排序创建客户端控制对象

有没有人成功使用带有 ldapjs 的服务器端排序控件?文档没有提供任何创建/使用此类控制对象的具体示例。

我已经在 openldap 服务器端启用了覆盖,但似乎无法为客户端控件提供正确的格式。我不确定 Buffer 值的正确格式来创建RFC 2891中提到的 SortKeyList

我收到以下错误:

我咨询了函数 ldapjs.ServerSideSortingRequestControl (选项)函数 ldapjs.Control (选项)无济于事。

0 投票
1 回答
9649 浏览

node.js - 错误您的锁定文件需要更新,但纱线是使用 `--frozen-lockfile` 运行的

我的 yarn.lock 文件中的一个依赖项存在问题。问题在于 ldapjs,最新版本有一个关于用户或密码中特殊字符的错误,所以我想将它冻结在最新的工作版本 1.0.2 中。

当我将代码提交到 master 分支时,构建这个项目的步骤开始失败,说出标题的信息。

这是我的码头文件

关于如何使这项工作的任何解决方法?

另外作为额外信息,我能够在功能分支中使用此步骤运行管道,消息在开发和主分支中开始。

[更新]

这些是我的 yarn.lock 文件中更新和冻结的依赖项

0 投票
1 回答
307 浏览

javascript - 如何处理 ldapjs 搜索方法中的错误

我必须连接到 LDAP 服务器并根据特定 ID 查找用户。

我决定使用 ldapjs 模块。

我设法创建了我的客户并绑定了他,以便我可以成功搜索用户。

我的问题是,因为我只使用 async/await,所以我不明白如何处理回调中的错误......例如使用 ldapjs 库中的这个简单代码:

LdapService.getClient()是返回 createClient 结果的单例方法 -> 工作正常

LdapService.bind()是一种仅使用正确凭据与服务器绑定的方法-> 工作正常

我只是无法处理我的错误“测试”......我应该如何处理它?

搜索方法真的是异步的吗?

我可以用异步/等待方式吗?:P

PS : DN 字符串 ("ou=,ou=,dc=,dc=") 由于安全原因被隐藏并且代码运行良好而不会引发错误;)

0 投票
1 回答
324 浏览

ldapjs - ldapjs 处理 client.search 响应

我有以下绑定到 LDAP 服务器的代码,我想返回在“interviewees”组中添加“ab”的用户(代码取自 ldapjs 客户端 api 页面)。我可以看到我正在从服务器返回带有预期 EventEmitter 对象的响应。我希望在 searchEntry 对象上调用 logging console.log() 时看到有关用户的信息。我似乎没有 searchEntry 对象。我的用户的 DN 是否正确?我目前不确定问题是否与我的查询有关,我没有得到任何数据,或者我是否未能正确处理响应?

活动目录结构如下

在此处输入图像描述

0 投票
1 回答
525 浏览

javascript - 在 ldapjs 中搜索

我正在尝试在我的 node.js 代码中使用 Ldap.js 的搜索方法。这是我的客户端代码。它成功添加了一个用户,但搜索新添加的用户不会产生任何结果。(ldap 服务器在来自https://github.com/osixia/docker-openldap的 docker 容器中运行)

另外,如果有帮助,这就是我通过运行显示来自 ldap 的所有用户时新添加的用户的样子docker exec my-openldap-container ldapsearch -x -H ldap://localhost:389 -b dc=example,dc=org -D "cn=admin,dc=example,dc=org" -w admin

更新:我可以使用 shell 命令成功搜索用户“userId7” docker exec ldap-service ldapsearch -LLL -x -D "cn=admin,dc=example,dc=org" -w "admin" -b "cn=userId7,dc=example,dc=org" "(objectclass=*)":. 我怎样才能让 ldapJS 也成功运行这个搜索?

更新 2:我还可以使用前端“phpLDAPadmin”成功搜索,如下面的屏幕截图所示: 搜索掩码 搜索结果