Problem I want to be able to use Windows Authentication with Node.js.
I understand that IIS handles Windows Authentication in ASP.NET, however what I can't figure out is, how I can get at the current Client Windows username from node.js. I get that it's not running via IIS (and don't really want to go down the IISNode route).
There must be a way of getting at the Client's windows username via Node.js - even if I have to write a C++ library / service.
Initial thoughts were that I'd be able to setup a web service within ASP.NET, which would use Windows authentication, and allow me to use a web request to get that user - but this is perhaps too naive!
I don't want to ask the user for their username and password - as this misses the point.
Any ideas, thoughts, or places I can look? Or is this just not possible?
Note: This is within a closed Intranet, and Windows Authentication is used within our ASP.NET applications along with Active Directory.
Approach
Unless I miss some of the requirements, you should be able to setup a IIS web site to relay requests to your Node.js application so that
Make sure to disable anonymous access and only use IWA for the IIS site.
Please see Relaying a request in ASP.NET for a couple of examples of how to relay requests in ASP.NET with C# or VB. You would also need to pass the user name with a header or a GET/POST parameter:
Response.AppendHeader("CustomUserNameHeader", Page.User.Identity.Name);
Assumptions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With