Skip to content

Instantly share code, notes, and snippets.

@gokulraja
Created May 14, 2020 18:58
Show Gist options
  • Save gokulraja/70120980e3aa9132db4a7e9379e110e8 to your computer and use it in GitHub Desktop.
Save gokulraja/70120980e3aa9132db4a7e9379e110e8 to your computer and use it in GitHub Desktop.
var express = require('express'),
ntlm = require('express-ntlm');
const port = 3000;
var app = express();
app.use(ntlm({
debug: function() {
var args = Array.prototype.slice.apply(arguments);
console.log.apply(null, args);
},
domain: 'MYDOMAIN',
domaincontroller: 'ldap://myad.example',
}));
app.all('*', function(request, response) {
response.end(JSON.stringify(request.ntlm)); // {"DomainName":"MYDOMAIN","UserName":"MYUSER","Workstation":"MYWORKSTATION"}
});
//app.listen(port);
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
//https://stackoverflow.com/questions/47677201/get-logged-windows-user-in-nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment