http-auth
Advanced tools
Comparing version 2.3.7 to 2.3.8
@@ -85,3 +85,7 @@ // Generated by CoffeeScript 1.10.0 | ||
return function(result) { | ||
if (!result.user) { | ||
if (result instanceof Error) { | ||
if (callback) { | ||
return callback.apply(_this, [req, res, result]); | ||
} | ||
} else if (!result.user) { | ||
return _this.ask(res, result); | ||
@@ -88,0 +92,0 @@ } else { |
@@ -41,8 +41,12 @@ // Generated by CoffeeScript 1.10.0 | ||
username, password, (function(_this) { | ||
return function(success) { | ||
return callback.apply(_this, [ | ||
{ | ||
user: success ? username : void 0 | ||
} | ||
]); | ||
return function(result) { | ||
if (result instanceof Error) { | ||
return callback.apply(_this, [result]); | ||
} else { | ||
return callback.apply(_this, [ | ||
{ | ||
user: result ? username : void 0 | ||
} | ||
]); | ||
} | ||
}; | ||
@@ -49,0 +53,0 @@ })(this) |
@@ -78,7 +78,11 @@ // Generated by CoffeeScript 1.10.0 | ||
return function(hash) { | ||
return callback.apply(_this, [ | ||
{ | ||
user: _this.validate(ha2, co, hash) ? co.username : void 0 | ||
} | ||
]); | ||
if (hash instanceof Error) { | ||
return callback.apply(_this, [hash]); | ||
} else { | ||
return callback.apply(_this, [ | ||
{ | ||
user: _this.validate(ha2, co, hash) ? co.username : void 0 | ||
} | ||
]); | ||
} | ||
}; | ||
@@ -85,0 +89,0 @@ })(this) |
@@ -5,4 +5,8 @@ // Generated by CoffeeScript 1.10.0 | ||
return function(req, res, next) { | ||
return authentication.check(req, res, function() { | ||
return next(); | ||
return authentication.check(req, res, function(req, res, error) { | ||
if (error) { | ||
return next(error); | ||
} else { | ||
return next(); | ||
} | ||
}); | ||
@@ -9,0 +13,0 @@ }; |
@@ -18,3 +18,11 @@ // Generated by CoffeeScript 1.10.0 | ||
newListener = function(req, res) { | ||
return authentication.check(req, res, listener); | ||
return authentication.check(req, res, function(req, res, err) { | ||
if (err) { | ||
console.error(err); | ||
res.statusCode = 400; | ||
return res.end(err.message); | ||
} else { | ||
return listener(req, res); | ||
} | ||
}); | ||
}; | ||
@@ -21,0 +29,0 @@ server = oldCreateServer.apply(http, [newListener]); |
@@ -18,3 +18,11 @@ // Generated by CoffeeScript 1.10.0 | ||
newListener = function(req, res) { | ||
return authentication.check(req, res, listener); | ||
return authentication.check(req, res, function(req, res, err) { | ||
if (err) { | ||
console.error(err); | ||
res.statusCode = 400; | ||
return res.end(err.message); | ||
} else { | ||
return listener(req, res); | ||
} | ||
}); | ||
}; | ||
@@ -21,0 +29,0 @@ server = oldCreateServer.apply(https, [arguments[1], newListener]); |
@@ -6,4 +6,8 @@ // Generated by CoffeeScript 1.10.0 | ||
middleware = function(req, res, next) { | ||
return authentication.check(req, res, function() { | ||
return next(); | ||
return authentication.check(req, res, function(req, res, error) { | ||
if (error) { | ||
return next(error); | ||
} else { | ||
return next(); | ||
} | ||
}); | ||
@@ -10,0 +14,0 @@ }; |
@@ -22,3 +22,6 @@ // Generated by CoffeeScript 1.10.0 | ||
var header; | ||
if (!result.user) { | ||
if (result instanceof Error) { | ||
console.error(result); | ||
return self.fail(400); | ||
} else if (!result.user) { | ||
header = self.authentication.generateHeader(result); | ||
@@ -25,0 +28,0 @@ return self.fail(header); |
@@ -25,4 +25,10 @@ // Generated by CoffeeScript 1.10.0 | ||
externalArguments = arguments; | ||
return authentication.check(req, res, function() { | ||
return oldProxyRequest.apply(server, externalArguments); | ||
return authentication.check(req, res, function(req, res, err) { | ||
if (err) { | ||
console.error(err); | ||
res.statusCode = 400; | ||
return res.end(err.message); | ||
} else { | ||
return oldProxyRequest.apply(server, externalArguments); | ||
} | ||
}); | ||
@@ -29,0 +35,0 @@ }; |
{ | ||
"name": "http-auth", | ||
"description": "Node.js package for HTTP basic and digest access authentication.", | ||
"version": "2.3.7", | ||
"version": "2.3.8", | ||
"author": "Gevorg Harutyunyan (http://github.com/gevorg)", | ||
@@ -6,0 +6,0 @@ "maintainers": [ |
@@ -41,3 +41,5 @@ # http-auth | ||
realm: "Simon Area." | ||
}, function (username, password, callback) { // Custom authentication | ||
}, function (username, password, callback) { | ||
// Custom authentication | ||
// Use callback(error) if you want to throw async error. | ||
callback(username === "Tina" && password === "Bullock"); | ||
@@ -183,2 +185,6 @@ } | ||
## Questions | ||
You can also use [stackoverflow](http://stackoverflow.com/questions/tagged/http-auth) to ask questions using **[http-auth](http://stackoverflow.com/tags/http-auth/info)** tag. | ||
## Requirements | ||
@@ -185,0 +191,0 @@ |
@@ -14,3 +14,3 @@ // Reporter. | ||
var tests = []; | ||
const newTests = ['test-koa.coffee']; | ||
const newTests = ['test-koa.coffee', 'test-koa-exception.coffee']; | ||
@@ -17,0 +17,0 @@ // Filter. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
86158
61
749
235