Skip to content

Instantly share code, notes, and snippets.

@gokulraja
Last active May 21, 2020 15:42
Show Gist options
  • Save gokulraja/cd81751511927fc262132cc489b9cc89 to your computer and use it in GitHub Desktop.
Save gokulraja/cd81751511927fc262132cc489b9cc89 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
//https://gist.github.com/gokulraja/76c3192a6d6c8bfbb132080ca874e25d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment