node.js - 这是否可以在nodejs中验证远程用户和密码存在检查?
问题描述
如何针对 Active Directory 验证用户名和密码?我只是想检查 nodejs 代码中的用户名和密码是否正确。
我用过活动目录 npm
但显示错误为
ERROR: {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","address":"96.45.82.8","port":389}
这是我的代码
var ActiveDirectory = require('activedirectory');
var config = { url: 'ldap://npsc.co.in',
baseDN: 'dc=npsc,dc=in',
username: 'user@npsc.co.in',
password: 'password' }
var ad = new ActiveDirectory(config);
var username = 'user@npsc.co.in';
var password = 'password';
ad.authenticate(username, password, function(err, auth) {
if (err) {
console.log('ERROR: '+JSON.stringify(err));
return;
}
if (auth) {
console.log(auth);
console.log('Authenticated!');
}
else {
console.log('Authentication failed!');
}
});
解决方案
推荐阅读
- scala - 散列火花数据框的多列
- php - 使用 Laravel 返回一对多 Eloquent Relation 中的最后一条记录
- http - 在真实网络中,服务器是否相互发送请求?
- elasticsearch - 如何根据 Elasticsearch 中的最大单词数对句子进行标记?
- reactjs - 为什么酶测试在 React 中不起作用?
- sql - 如何知道外键是否在删除子句上有级联
- rust - 当变量和函数同名时如何调用函数?
- c# - 单个文件夹应可供组织中的所有用户使用
- c# - 反序列化字符串(AuthenticationHeaderValue.Parameter)
- python - 为什么要在赋值之前先定义一个list类型的python变量?