Comparing version 1.0.1 to 1.0.2
@@ -43,1 +43,3 @@ var async = require('async'); | ||
exports.ntlm = ntlm; //if you want to use the NTML functions yourself | ||
{ | ||
"name": "httpntlm", | ||
"description": "httpntlm is a Node.js library to do HTTP NTLM authentication", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"dependencies": { | ||
@@ -6,0 +6,0 @@ "httpreq": "~0.3.4", |
@@ -34,2 +34,55 @@ # httpntlm | ||
## Advanced | ||
If you want to use the NTLM-functions yourself, you can access the ntlm-library like this: | ||
var ntlm = require('httpntlm').ntlm; | ||
var async = require('async'); | ||
var httpreq = require('httpreq'); | ||
var HttpsAgent = require('agentkeepalive').HttpsAgent; | ||
var keepaliveAgent = new HttpsAgent(); | ||
var options = { | ||
url: "https://someurl.com", | ||
username: 'm$', | ||
password: 'stinks', | ||
workstation: 'choose.something', | ||
domain: '' | ||
}; | ||
async.waterfall([ | ||
function (callback){ | ||
var type1msg = ntlm.createType1Message(options); | ||
httpreq.get(options.url, { | ||
headers:{ | ||
'Connection' : 'keep-alive', | ||
'Authorization': type1msg | ||
}, | ||
agent: keepaliveAgent | ||
}, callback); | ||
}, | ||
function (res, callback){ | ||
if(!res.headers['www-authenticate']) | ||
return callback(new Error('www-authenticate not found on response of second request')); | ||
var type2msg = ntlm.parseType2Message(res.headers['www-authenticate']); | ||
var type3msg = ntlm.createType3Message(type2msg, options); | ||
httpreq.get(options.url, { | ||
headers:{ | ||
'Connection' : 'Close', | ||
'Authorization': type3msg | ||
}, | ||
allowRedirects: false, | ||
agent: keepaliveAgent | ||
}, callback); | ||
} | ||
], function (err, res) { | ||
if(err) return console.log(err); | ||
console.log(res.headers); | ||
console.log(res.body); | ||
}); | ||
## More information | ||
@@ -36,0 +89,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20156
352
92