简体   繁体   English

从NTLM令牌Javascript获取用户名

[英]Get Username from NTLM token Javascript

I used NTLM authentication at IIS server and I am using rewrite module of IIS to redirect that port to nodejs port. 我在IIS服务器上使用NTLM身份验证,并且正在使用IIS的重写模块将该端口重定向到nodejs端口。

Now I am getting authorization header in nodejs with NTLM token. 现在,我在带有NTLM令牌的nodejs中获得授权标头。

Now my question is, 现在我的问题是

  • How can I get username in form of {domainName}{userName} from NTLM token in nodejs? 如何从Node.js中的NTLM令牌获取{domainName} {userName}形式的用户名?

  • Can I get groups of that user from nodejs? 我可以从nodejs获取该用户的组吗? How? 怎么样?

There are several libraries available to handle NTLM in Node, including: 有几种库可用于处理Node中的NTLM,包括:

node-http-ntlm 节点-http-ntlm
express-ntlm 表达网络

These make it very simple to do something like: 这些使执行以下操作变得非常简单:

httpntlm.get({
    url: "https://someurl.com",
    username: 'm$',
    password: 'stinks',
    workstation: 'choose.something',
    domain: ''
}

If you don't want to use one of these libraries, you will have to decode the token yourself. 如果您不想使用这些库之一,则必须自己解码令牌。

You can view the source of those libbraries for help on how to do this: 您可以查看这些库的源,以获取有关如何执行此操作的帮助:

https://github.com/SamDecrock/node-http-ntlm/blob/master/ntlm.js https://github.com/SamDecrock/node-http-ntlm/blob/master/ntlm.js
https://github.com/einfallstoll/express-ntlm/blob/master/lib/express-ntlm.js https://github.com/einfallstoll/express-ntlm/blob/master/lib/express-ntlm.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM