express-access-control
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -70,3 +70,6 @@ //Copyright (c) 2015 Eric Vallee <eric_vallee2003@yahoo.ca> | ||
{ | ||
Res.status(401).end(); | ||
var Err = new Error(); | ||
Err.Source = "ExpressAccessControl"; | ||
Err.Type = "NoAccess"; | ||
Next(Err); | ||
} | ||
@@ -73,0 +76,0 @@ }); |
{ | ||
"name": "express-access-control", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Middleware to perform access control based on the user's session and groups.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -69,3 +69,3 @@ Express-Access-Control | ||
If the user doesn't pass authentication, the 401 code is returned as a response, else Next() is called to go to the next route handler. | ||
If the user doesn't pass authentication, then Next(Err) is called, where Err is an error with Err.Source set to "ExpressAccessControl" and Err.Type set to "NoAccess". If the user passes authentication, then Next() is called to go to the next route handler. | ||
@@ -160,3 +160,6 @@ <Options> can take 2 formats: | ||
2.0.0 | ||
----- | ||
The library's 'AuthenticateRoute' method will now deleguate the response to an error handler if the user doesn't pass authentication. | ||
@@ -163,0 +166,0 @@ |
@@ -16,2 +16,12 @@ //Copyright (c) 2015 Eric Vallee <eric_vallee2003@yahoo.ca> | ||
}); | ||
App.use('/', function(Err, Req, Res, Next) { | ||
if(Err.Source && Err.Source === 'ExpressAccessControl') | ||
{ | ||
Res.status(401).end(); | ||
} | ||
else | ||
{ | ||
Next(Err); | ||
} | ||
}); | ||
Context['Server'] = Http.createServer(Context['App']); | ||
@@ -18,0 +28,0 @@ Context['Server'].listen(8080, function() { |
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
29582
9
223
167