ExpressJS:带有LDAP API的POST请求

时间:2018-11-15 06:54:04

标签: node.js express post routes axios

我正在尝试实现一种POST方法,该方法将仅将用户名和密码发布到我的Mongodb中。但是,在发布凭据之前,它必须连接到LDAP API进行身份验证。 LDAP API具有标头,即基本身份验证,作为ADMIN,我必须提供特定的用户名和密码来访问该特定的LDAP(与用户凭据不同)。我的问题是我已经搜索了很多东西,并得出一个结论,这样做的正确方法是对这样的HTTP请求使用AXIOS

不幸的是,我没有找到以下疑问的解决方案:

  1. 如何将用户名和密码(用户凭据)传递给LDAP API进行验证?
  2. 如何通过LDAP API用户名和密码来连接到LDAP并可以访问它。

这些是我需要建立与LDAP API的连接的LDAP信息-

  

****内容类型:application / json授权:基本324t5yuj基本身份验证用户名:xyz密码:***********


这是我目前的发布方式 这很简单

router.post('/user',function(req,res){
    //Before passing the follwoing username and pass, I must provide the LDAP API with its own password and username(this is where I am also stuck)
    //the username and password here are being taken from the user , these credentials are to be passed to the LDAP API to verify user
    user : req.body.username ,
    pass: req.body.password
    });

0 个答案:

没有答案
相关问题