Tuesday, 18 December 2018

Serverside NodeJS - need client windows ID

(intranet application) I'm using ReactJS with NodeJS as a server side api for accessing various resources (such as user active directory profile). I need to integrate with Active Directory, without prompting the user for their credentials.

Using ActiveDirectory for Node (npm i activedirectory) I can query the AD using LDAP for a hard coded sAMAccountName using the code below.

ad.findUser(sAMAccountName, function(err, user) {
    if (err) {
      console.log('ERROR: ' + JSON.stringify(err));
    }

    if (!user) console.log('User: ' + sAMAccountName + ' not found.');
    else {
      thisUser = user;
    }
  });

But what I cant figure out, is how to pick up the current user ID when they call the API.

These 2 examples give the 'Server' user id, rather then the client ID:

const user = process.env;
const user = require('os').userInfo().username;

In .net I would normally do this with

string NTID = HttpContext.Current.User.Identity.Name;

So is there a way in NodeJS, running on a server, to access the client user ID?



from Serverside NodeJS - need client windows ID

No comments:

Post a Comment