我有一个2016 年和2016 年的AWS
目录服务加入了, 并将用户放入,Microsoft AD
EC2 Windows Server
AD
AD
我的问题是我将如何使用 npm 包访问 AD activedirectory
,ldapjs
或者ldap-client
下面是我的代码片段:
let ActiveDirectory = require('activedirectory');
let adConfig = {
url: 'ldap://ec2-*-*-*-152.ap-southeast-1.compute.amazonaws.com',
baseDN: 'DC=corp,DC=***,DC=com',
username: 'CN=Admin,OU=Users,OU=corp,DC=corp,DC=***,DC=com',
password: '*******'
};
let ad = new ActiveDirectory(adConfig);
let username = 'j***@corp.***.com';
let password = '******';
ad.authenticate(username, password, function(err, auth) {
if (err) {
console.log('=== executed this err block ===');
console.error('ERROR: ' + JSON.stringify(err));
return;
}
if (auth) {
console.log('Authenticated');
return;
}
console.log('Authentication failed');
});
返回错误: {"code":"ETIMEDOUT","errno":"ETIMEDOUT","syscall":"connect","address":" . .*.152","port":389}
提供的 URL 是我的 ec2 的公共 DNS(安全组为所有端口号打开)实例加入 AWS AD