使用节点中的Active Directory进行身份验证

时间:2018-06-27 07:02:56

标签: node.js active-directory

我正在尝试使用NodeJS中的Active Directory在登录时对用户进行身份验证。但我无法使其正常运行。当我提交登录表单时,它将保持加载状态。

这是NodeJS中的post方法:

router.post('/login', function(req, res, next){
  var AD_data = {
    username: req.body.username,
    password: req.body.password
  };
  ad.authenticate(AD_data.username, AD_data.password, function(err, auth) {
    if (err) {
      console.log('ERROR: '+JSON.stringify(err));
      return;
    }
    if (auth) {
      console.log('Authenticated!');
    }
    else {
      console.log('Authentication failed!');
    }
  });
});

0 个答案:

没有答案