YMFE / yapi

YApi 是一个可本地部署的、打通前后端及QA的、可视化的接口管理平台
http://yapi.smart-xwork.cn/
Apache License 2.0
27.39k stars 4.8k forks source link

能集成AD登录方式吗? #730

Open vicsoulz opened 5 years ago

vicsoulz commented 5 years ago

能集成AD登录方式吗?

AllenBean commented 5 years ago

YApi对接AD域控用户登录 修改vi ../config.json配置文件如下: "ldapLogin": {       "enable": true,       "server": "ldap://192.168.1.10", //AD域控服务器       "baseDn": "yapi@test.com", //AD域控用对应给与一个认证用户       "bindPassword": "Test1234", //对应认证用户密码       "searchDn": "OU=技术中心,DC=test,DC=com", //可读取的OU路径       "searchStandard": "&(objectCategory=Person)(sAMAccountName=%s)", //MS AD的用户属性       "emailPostfix": "", //非必须可为空       "emailKey": "", //非必须可为空       "usernameKey": "sAMAccountName" 用户登录密码取值为对应用户属性,原因为AD密码不可逆,只取此值   }

huadong204 commented 4 years ago

YApi对接AD域控用户登录 修改vi ../config.json配置文件如下: "ldapLogin": { "enable": true, "server": "ldap://192.168.1.10", //AD域控服务器 "baseDn": "yapi@test.com", //AD域控用对应给与一个认证用户 "bindPassword": "Test1234", //对应认证用户密码 "searchDn": "OU=技术中心,DC=test,DC=com", //可读取的OU路径 "searchStandard": "&(objectCategory=Person)(sAMAccountName=%s)", //MS AD的用户属性 "emailPostfix": "", //非必须可为空 "emailKey": "", //非必须可为空 "usernameKey": "sAMAccountName" 用户登录密码取值为对应用户属性,原因为AD密码不可逆,只取此值 }

按照这个配置,报一个错: TypeError: name (string) required at Client.bind (/yapi/vendors/node_modules/ldapjs/lib/client/client.js:467:11) at Promise.then.searchDn (/yapi/vendors/server/utils/ldap.js:98:16) at new Promise () at /yapi/vendors/server/utils/ldap.js:96:12 at new Promise () at Object.exports.ldapQuery (/yapi/vendors/server/utils/ldap.js:8:10) at userController.getLdapAuth (/yapi/vendors/server/controllers/user.js:138:45) at /yapi/vendors/server/utils/commons.js:439:28 at processTicksAndRejections (internal/process/task_queues.js:93:5) at async module.exports (/yapi/vendors/server/middleware/mockServer.js:152:15)