node.js - 使用 ldap.js 的 Active Directory 身份验证

标签 node.js authentication active-directory ldap

我一直在尝试使用 ldap.js 向 Active Directory Windows 2008 服务器进行身份验证。唯一的目标是向服务器进行身份验证,我正在使用客户端的东西(不是创建新服务器,这就是 documentation 的全部内容)。我是 LDAP 的新手,因此,使用用户名“MYDOMAIN\myuser”进行身份验证在 ldap.js 中不起作用,但在 ldapsearch 中起作用:ldapsearch -H ldap://192.168.1.212:389 -x -D 'MYDOMAIN\myuser' -w pa33w0rd -LLL -b "dc=mydomain"'(sAMAccountName=myuser)' 验证成功但随后吐出 Referral (10)

在 ldap.js 中尝试使用 client.bind("MYDOMAIN\myuser", 'pa33w0rd', function(err) { ... } ); 失败并返回 49 InvalidCredentialsError 80090308 : LdapErr: DSID-0C0903A9,评论:AcceptSecurityContext 错误,...

尝试将 MYDOMAIN\myuser 重写为专有名称 dn: cn=myuser, dc=mydomain 也失败,在 ldap 搜索中也出现身份验证错误。将 DOMAIN\USER(域反斜杠用户格式)转换为 DN 的正确方法是什么?

最佳答案

来自 http://www.rlmueller.net/NameTranslateFAQ.htm :

  1. Distinguished Names - format as specified in RFC 1779. For example cn=TestUser,ou=Sales,dc=MyDomain,dc=com.
  2. NT format - the name format used in Windows NT 4.0. For example MyDomain\TestUser, where MyDomain is the NetBIOS name of the domain and TestUser is the NT name of the object (the pre-Windows 2000 name). The value of the sAMAccountName attribute is the NT name of the object.

因此,NT格式(域反斜杠用户)登录名MYDOMAIN\myuser可以映射到cn=myuser,cn=Users,dc=mydomain,dc=comcn=myuser,cn=Users,dc=mydomain,dc=local 或其他一些。建议你看一下AD服务器的hosts文件或者DNS域名。您还应该更改 -b(基础)以包括 dc=com 或 dc=local,或任何修复引用错误的内容。

关于node.js - 使用 ldap.js 的 Active Directory 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18970127/

相关文章:

node.js - 该平台不支持代理

node.js - Meteor.setTimeout 不会造成延迟

ios - 使用带有完成处理程序的 NSURLConnection sendAsynchronousRequest 进行身份验证

java - 使用 Java 8 获取受密码保护的 URL 的内容

powershell - 如何根据组扩展属性获取用户所属的所有组

node.js - mongodb $where 查询对于 nodejs 始终为真

javascript - 如何使用rollupjs删除d3选择中的循环依赖?

api - 如何处理 “App is temporarily blocked from logging in with your Google account” 屏障

powershell - 通过PowerShell修改AD中的属性(无任务)