简体   繁体   中英

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.

Now I am getting authorization header in nodejs with NTLM token.

Now my question is,

  • How can I get username in form of {domainName}{userName} from NTLM token in nodejs?

  • Can I get groups of that user from nodejs? How?

There are several libraries available to handle NTLM in Node, including:

node-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/einfallstoll/express-ntlm/blob/master/lib/express-ntlm.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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