簡體   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