简体   繁体   中英

How to implement username/password auth with express ntlm?

I am trying to implement username and password auth with Express-ntlm.I have added below code as middleware

app.use( ntlm({
domain: '<domainname>',
domaincontroller: '<ldap url>',
}));

I am not providing any user name password in the request and its automatically adding ntlm header in the request with my loggedin user details. I am getting {Authenticated:true} along with my username and system name in request.ntlm . How can I provide different username/password in this and authenticate? Also will this work if I login from linux/mac system?

If you use a supported browser (eg IE) NTLM will automatically log the user in using the current session in Windows. express-ntlm will just receive this information and exposes it to the application.

If you want to use other credentials you have to log in using a different user in Windows or use a browser that will show you a prompt for username and password if it gets an NTLM challenge. If I remember correctly Chrome will do it like this.

I never tried it using macOS/Linux, but I'm sure most browser will just provide you a username/password prompt.

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