简体   繁体   English

NPM-ActiveDirectory模块身份验证

[英]NPM - ActiveDirectory Module Authentication

I am using activedirectory module from npmjs in one of my node application to authenticate against Active Directory, My question Is- Is it required to send plain string password while authenticating with AD? 我在我的一个节点应用程序中使用npmjs中的activedirectory模块针对Active Directory进行身份验证,我的问题是-在通过AD进行身份验证时是否需要发送纯字符串密码? I mean if ad stores the user password it must be encrypting it in someway or other, can we send a encrypted password for authentications? 我的意思是,如果广告存储了用户密码,那么它必须以某种方式对其进行加密,我们可以发送加密的密码进行身份验证吗? Here is what I mean - 这就是我的意思-

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!');
  }
})

The solution is to use ldaps (Secure LDAP) and provide a CA for verification when you first connect. 解决方案是使用ldaps(安全LDAP)并在首次连接时提供CA进行验证。 The credentials being sent over the wire will be encrypted and MITM attacks won't work if you forcing certificate verification. 通过有线发送的凭据将被加密,如果您强制进行证书验证,则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