繁体   English   中英

NPM-ActiveDirectory模块身份验证

[英]NPM - ActiveDirectory Module Authentication

我在我的一个节点应用程序中使用npmjs中的activedirectory模块针对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 
    }
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM