I have a web server based on node.js which provides REST API. Currently it accepts username and password for authentication. There is a .NET client which offers a login form which gathers the data and sends it to the service.
The new requirement is to offer Active Directory authentication, so that users don't have to input usernames and passwords when logging in to the web server, but can be automatically logged in with the credentials they provided when logging to the machine which is a part of Active Directory and has the client installed. The web service machine is also a part of Active Directory.
This seems like a common problem, and in theory does not seem hard:
- The user logs in into machine with client installed
- The user starts the client, the client acquires security token from the system
- The client sends this token to the web service somehow (in the header, body, does not matter, service will know where to read it from)
- The service acquires the token and using the data inside it, gets Active Directory username, thus ending authentication phase
It is quite similar to how JWT works which we use now with the difference that security token is generated not by the service, but by Active Directory.
With theory in place I still can't figure out the minimum project which works on these principles. How exactly does .NET client acquires the token? How node.js service is going to validate it and extract username from it? There are bits and pieces across the net, but nothing actually working in this configuration. There are a lot of third party libraries with sspi, kerberos, passport and ldap in names which only make matters worse, I would like to start with a basic sample, which directly uses system APIs, to understand the principle.