从节点中的 Active Directory 获取经过身份验证的用户组
Get authenticated user's groups from Active Directory in Node
我们被要求将我们的 NodeJS 应用程序移动到 IIS (Windows Server 2012R2) 下的 运行 并与现有的 Active Directory 集成。我们被要求删除登录页面,而是使用 Windows 身份验证来获取(已通过身份验证的)用户的 ID,并使用 he/she 所属的组来控制他们在应用程序中的授权级别。
我已经安装了 iisnode to run my app under IIS, and figured I'll use either passport-windowsauth, or node-activedirectory 以获得群组成员身份。但是,两者都需要 user/password 来验证用户。我的用户 已经通过身份验证 ,我无权访问他的密码(我也不应该)。
如何从 Active Directory 获取经过身份验证的用户组?
这是我目前的情况:
- 已安装并配置 iisnode
- 已启用 Windows Web 应用程序身份验证
- 将此添加到 web.config:
<iisnode promoteServerVars="AUTH_USER,AUTH_TYPE" />
- 在我的
index.js
文件中,我可以 console.log(req.headers['x-iisnode-auth_user']);
并获得正确的用户名 - 但我不知道如何从这里继续获得 his/her 组
- 在任何情况下我都不想重新询问用户 his/her 密码
嗯,好像没人有兴趣看这个问题:)。我假设 IIS + Node.js + Active Directory 是一种边缘情况。
这是我最终解决这个问题的方法:
- 向 Active Directory 添加一个只能从 IIS 计算机登录的特殊用户(奖励:限制该用户的 IP/process/access)。
- 将 AD 详细信息、用户名和密码添加到
config.json
文件(参见 snippet)。
确保将文件添加到 .gitignore
,这样它就不会在 repo 中结束。
- 使用node-ActiveDirectory to first sign in as the user from step 1, and then ask for the groups of the logged in user (see snippet).
我们被要求将我们的 NodeJS 应用程序移动到 IIS (Windows Server 2012R2) 下的 运行 并与现有的 Active Directory 集成。我们被要求删除登录页面,而是使用 Windows 身份验证来获取(已通过身份验证的)用户的 ID,并使用 he/she 所属的组来控制他们在应用程序中的授权级别。
我已经安装了 iisnode to run my app under IIS, and figured I'll use either passport-windowsauth, or node-activedirectory 以获得群组成员身份。但是,两者都需要 user/password 来验证用户。我的用户 已经通过身份验证 ,我无权访问他的密码(我也不应该)。
如何从 Active Directory 获取经过身份验证的用户组?
这是我目前的情况:
- 已安装并配置 iisnode
- 已启用 Windows Web 应用程序身份验证
- 将此添加到 web.config:
<iisnode promoteServerVars="AUTH_USER,AUTH_TYPE" />
- 在我的
index.js
文件中,我可以console.log(req.headers['x-iisnode-auth_user']);
并获得正确的用户名 - 但我不知道如何从这里继续获得 his/her 组 - 在任何情况下我都不想重新询问用户 his/her 密码
嗯,好像没人有兴趣看这个问题:)。我假设 IIS + Node.js + Active Directory 是一种边缘情况。 这是我最终解决这个问题的方法:
- 向 Active Directory 添加一个只能从 IIS 计算机登录的特殊用户(奖励:限制该用户的 IP/process/access)。
- 将 AD 详细信息、用户名和密码添加到
config.json
文件(参见 snippet)。
确保将文件添加到.gitignore
,这样它就不会在 repo 中结束。 - 使用node-ActiveDirectory to first sign in as the user from step 1, and then ask for the groups of the logged in user (see snippet).