ldap Invalid Credentials While Authenticating User(NodeJs)



有两个Active Directory (LDAP服务器)。以下是属于各自服务器的用户:

Server         user                         password
1-   abc.pk           user_abc@abc.pk              ********
2-   xyz.com.pk       user_xyz@xyz.com.pk          ******** 

我正在用库(ActiveDirectory)对NodeJS中的用户进行身份验证。下面是我验证user_xyz@xyz.com.pk的代码

const ActiveDirectory = require('activedirectory');
var ad = new ActiveDirectory({
"url": "ldap://xyz.com.pk",
"baseDN": "DC=xyz,DC=com,DC=pk"
});
ad.authenticate(username, password, function(err, auth) {
console.log('auth function called with username: '+username);
if (err) {
console.log('auth function called and with following err  '+JSON.stringify(err));
return;
}           
if (auth) {
console.log('Authenticated from Active directory!');
});

可以正常工作。如果我验证user_abc@abc.pk,同样可以正常工作

从服务器1更新url和baseDN。
var ad = new ActiveDirectory({
"url": "ldap://abc.pk",
"baseDN": "DC=abc,DC=pk"
});       
<<p>服务器strong> abc.pk 与服务器xyz.com.pk有信任关系. 意味着我必须验证用户user_abc@abc.pkxyz.com.pk. 使用以下配置:
var ad = new ActiveDirectory({
"url": "ldap://xyz.com.pk",
"baseDN": "DC=xyz,DC=com,DC=pk"
});

,但现在面临无效凭据的错误。这就是我所面临的确切错误{"lde_message"; "80090308: LdapErr: DSID-0C090453,注释:AcceptSecurityContext错误,数据52e, v3839u0000","lde_dn":null}

验证user_abc@abc.pkxyz.com.pk带有Active Directory资源管理器的服务器

Active Directory资源管理器image

如果有人能给我一个解决办法,那就太好了。由于

我通过检查以下两件事解决了这个问题:1.-配置必须在baseDN部分分开:

var config = {
url: 'ldap://aaa.bbb.ccc.ddd',
baseDN: 'DC=aaa,DC=bbb,DC=ccc,DC=ddd'

};

2。-问题似乎不是来自代码https://community.arubanetworks.com/community-home/digestviewer/viewthread?MID=40296#:~:text=%22AcceptSecurityContext%20error%2C%20data%2052e%22,instead%20of%20just%20the%20username.

根据帖子,有时可能需要域名服务器进行认证。有必要验证它是否适用于">用户名";或">username@aaa.bbb.ccc.ddd";或">aaa.bbb.ccc.ddd 用户名";这取决于用户注册的方式

我希望我的经验能派上用场。欢呼声

最新更新