node.js - NPM - ActiveDirectory 模块身份验证

标签 node.js authentication encryption npm active-directory

我正在使用activedirectory module从我的 Node 应用程序之一中的 npmjs 来针对 Active Directory 进行身份验证,我的问题是 - 在使用 AD 进行身份验证时是否需要发送纯字符串密码?我的意思是,如果广告存储用户密码,它必须以某种方式对其进行加密,我们可以发送加密密码进行身份验证吗?这就是我的意思 -

ad.authenticate(username, password, function(err, auth) { 
// instead of plain password can it be encrypted password?
 if (err) {
    console.log('ERROR: '+JSON.stringify(err));
    return;
  }

  if (auth) {
    console.log('Authenticated!');
  }
  else {
    console.log('Authentication failed!');
  }
})

最佳答案

解决方案是使用 ldaps(安全 LDAP)并在首次连接时提供 CA 进行验证。通过网络发送的凭据将被加密,如果您强制进行证书验证,MITM 攻击将不起作用。

const ActiveDirectory = require("activedirectory");
const ad = new ActiveDirectory({
    url: "ldaps://dc.domain.com",
    baseDN: "dc=domain,dc=com",
    username: "username@domain.com",
    password: "password",
    tlsOptions: {
        ca: [fs.readFileSync("CA.crt")],
        rejectUnauthorized: true // Force Certificate Verification 
    }
});

关于node.js - NPM - ActiveDirectory 模块身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43888654/

相关文章:

javascript - 使用 .pipe() 时出现 node.js fs.createReadStream 错误

node.js - 如何从Google Drive API导出方法正确地将PDF读入node js缓冲区?

authentication - Freeradius 用户运营商

google-app-engine - 为什么 Google App Engine 在登录期间附加到我的 'continue' 位置的路径?

java - PKCS1-padding/RSA 加密 ios objc 和 java 的区别

angularjs - 更新函数仅在数据库中存储名称属性而不是 url 属性,而是存储未定义

javascript - 如何从nodeJS中的页面调用文件

unit-testing - 使用谷歌验证器进行单元测试

ssl - OpenSSL:指定应用程序数据的数据包大小

html - 如何加密表单中的 HTML 字段,然后在服务器上对其进行解密?