How to implement username/password auth with express ntlm?

1k views Asked by At

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?

1

There are 1 answers

3
Fabio Poloni On

If you use a supported browser (e.g. 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.