http-auth
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -95,23 +95,28 @@ /** | ||
// Checking response for username. | ||
var ha1 = util.md5(this.users[co.username]); | ||
// If algorithm is MD5-sess. | ||
if(co.algorithm == 'MD5-sess') { | ||
ha1 = util.md5(ha1 + ":" + co.nonce + ":" + co.cnonce); | ||
} | ||
// If qop is specified. | ||
if(co.qop) { | ||
if(co.nc > this.nonces[co.nonce]) { | ||
// Updating nonce count. | ||
this.nonces[co.nonce] = co.nc; | ||
var userHash = this.users[co.username]; | ||
// Username is correct. | ||
if(userHash) { | ||
var ha1 = util.md5(userHash); | ||
// If algorithm is MD5-sess. | ||
if(co.algorithm == 'MD5-sess') { | ||
ha1 = util.md5(ha1 + ":" + co.nonce + ":" + co.cnonce); | ||
} | ||
// If qop is specified. | ||
if(co.qop) { | ||
if(co.nc > this.nonces[co.nonce]) { | ||
// Updating nonce count. | ||
this.nonces[co.nonce] = co.nc; | ||
// Evaluating final authentication response. | ||
var authRes = util.md5(ha1 + ":" + co.nonce + ":" + co.nc + ":" + co.cnonce + ":" + co.qop + ":" + ha2); | ||
authenticated = (authRes == co.response); | ||
} | ||
} else { | ||
// Evaluating final authentication response. | ||
var authRes = util.md5(ha1 + ":" + co.nonce + ":" + co.nc + ":" + co.cnonce + ":" + co.qop + ":" + ha2); | ||
var authRes = util.md5(ha1 + ":" + co.nonce + ":" + ha2); | ||
authenticated = (authRes == co.response); | ||
} | ||
} else { | ||
// Evaluating final authentication response. | ||
var authRes = util.md5(ha1 + ":" + co.nonce + ":" + ha2); | ||
authenticated = (authRes == co.response); | ||
} | ||
@@ -118,0 +123,0 @@ } |
{ | ||
"name": "http-auth", | ||
"description": "Module for HTTP basic and digest access authentication.", | ||
"version": "1.0.1", | ||
"description": "Node.js module for HTTP basic and digest access authentication.", | ||
"version": "1.0.2", | ||
"author": "Gevorg Harutyunyan", | ||
@@ -12,3 +12,3 @@ "maintainers": [ | ||
], | ||
"homepage": "https://github.com/gevorg/http-auth", | ||
"homepage": "http://gevorg.me/http-auth.html", | ||
"repository": { | ||
@@ -15,0 +15,0 @@ "type": "git", |
# http-auth | ||
Module for HTTP basic and digest access authentication. | ||
[Node.js](http://nodejs.org/) module for HTTP basic and digest access authentication. | ||
@@ -13,19 +13,6 @@ ## Installation | ||
$ npm install http-auth | ||
## Usage | ||
Digest access authentication usage: | ||
-------------------- | ||
/** | ||
* HTTP authentication module. | ||
*/ | ||
var auth = require('http-auth'); | ||
## Digest access authentication usage | ||
/** | ||
* HTTP module. | ||
*/ | ||
var http = require('http'); | ||
/** | ||
* Requesting new digest access authentication instance. | ||
@@ -48,20 +35,6 @@ */ | ||
}).listen(1337); | ||
// Log url. | ||
console.log('Server running at http://127.0.0.1:1337/'); | ||
Basic access authentication usage: | ||
-------------------- | ||
/** | ||
* HTTP authentication module. | ||
*/ | ||
var auth = require('http-auth'); | ||
## Basic access authentication usage | ||
/** | ||
* HTTP module. | ||
*/ | ||
var http = require('http'); | ||
/** | ||
* Requesting new basic access authentication instance. | ||
@@ -83,20 +56,6 @@ */ | ||
}).listen(1337); | ||
// Log url. | ||
console.log('Server running at http://127.0.0.1:1337/'); | ||
You can load users from file: | ||
-------------------- | ||
/** | ||
* HTTP authentication module. | ||
*/ | ||
var auth = require('http-auth'); | ||
## You can load users from file | ||
/** | ||
* HTTP module. | ||
*/ | ||
var http = require('http'); | ||
/** | ||
* Requesting new digest access authentication instance. | ||
@@ -119,19 +78,5 @@ */ | ||
// Log url. | ||
console.log('Server running at http://127.0.0.1:1337/'); | ||
You can also use it with [express framework](http://expressjs.com/): | ||
-------------------- | ||
/** | ||
* HTTP authentication module. | ||
*/ | ||
var auth = require('http-auth'); | ||
## You can also use it with [express framework](http://expressjs.com/) | ||
/** | ||
* Express module. | ||
*/ | ||
var express = require('express'); | ||
/** | ||
* Requesting new digest access authentication instance. | ||
@@ -144,9 +89,4 @@ */ | ||
}); | ||
/** | ||
* Creating new server. | ||
*/ | ||
var app = express.createServer(); | ||
/** | ||
* Handler for digest path, with digest access authentication. | ||
@@ -157,12 +97,3 @@ */ | ||
}); | ||
/** | ||
* Start listenning 1337 port. | ||
*/ | ||
app.listen(1337); | ||
// Log url. | ||
console.log('Server running at http://127.0.0.1:1337/'); | ||
## Configurations | ||
@@ -169,0 +100,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
No website
QualityPackage does not have a website.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
522
3
20550
1
114