otto-authentication
Advanced tools
Comparing version 0.0.2 to 0.1.0
{ | ||
"name" : "otto-authentication", | ||
"version" : "0.0.2", | ||
"version" : "0.1.0", | ||
"repository" : "https://github.com/ottojs/otto-authentication.git", | ||
"main" : "./lib/index.js", | ||
"dependencies" : { | ||
"otto-errors" : "0.0.2", | ||
"basic-auth" : "1.0.0" | ||
"basic-auth" : "1.0.0", | ||
"otto-errors" : "0.1.0" | ||
}, | ||
"devDependencies" : { | ||
"jshint" : "2.5.2", | ||
"mocha" : "1.21.4", | ||
"should" : "4.0.4", | ||
"supertest" : "0.13.0", | ||
"sinon" : "1.10.3", | ||
"istanbul" : "0.3.0", | ||
"otto" : "0.0.4" | ||
"jshint" : "2.5.10", | ||
"mocha" : "2.0.1", | ||
"should" : "4.3.0", | ||
"supertest" : "0.15.0", | ||
"istanbul" : "0.3.2", | ||
"otto" : "0.1.0" | ||
}, | ||
@@ -23,5 +22,4 @@ "scripts" : { | ||
"engines" : { | ||
"node" : "0.10.x", | ||
"npm" : "1.4.x" | ||
"node" : "0.10.x" | ||
} | ||
} |
@@ -13,33 +13,36 @@ | ||
// New Otto/Express App | ||
var app = otto.app(); | ||
var app = otto.app({ | ||
routes : [ | ||
function (app) { | ||
// Public Route | ||
app.get('/public', function (req, res) { | ||
res.status(200).send({ public_page : true }); | ||
}); | ||
// Public Route | ||
app.get('/public', function (req, res) { | ||
res.status(200).send({ public_page : true }); | ||
}); | ||
// Protected Route (bob/bobisthebest) | ||
app.get('/protected', [ | ||
otto_authentication.http_basic('bob', 'bobisthebest'), | ||
function (req, res) { | ||
res.status(200).send({ protected_page : true }); | ||
} | ||
]); | ||
// Protected Route (bob/bobisthebest) | ||
app.get('/protected', [ | ||
otto_authentication.http_basic('bob', 'bobisthebest'), | ||
function (req, res) { | ||
res.status(200).send({ protected_page : true }); | ||
} | ||
]); | ||
// Protected Route custom | ||
app.get('/custom', [ | ||
otto_authentication.custom(function (req, allow) { | ||
if (req.query.letmein && req.query.letmein === 'now') { | ||
return allow(true); | ||
// Protected Route custom | ||
app.get('/custom', [ | ||
otto_authentication.custom(function (req, allow) { | ||
if (req.query.letmein && req.query.letmein === 'now') { | ||
return allow(true); | ||
} | ||
allow(false); | ||
}), | ||
function (req, res) { | ||
res.status(200).send({ custom_authentication : true }); | ||
} | ||
]); | ||
} | ||
allow(false); | ||
}), | ||
function (req, res) { | ||
res.status(200).send({ custom_authentication : true }); | ||
} | ||
]); | ||
] | ||
}); | ||
// Handle Errors | ||
otto.error_handler(app); | ||
// Bind SuperTest | ||
@@ -46,0 +49,0 @@ var request = supertest(app); |
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
9026
6
200
+ Addedotto-errors@0.1.0(transitive)
- Removedotto-errors@0.0.2(transitive)
Updatedotto-errors@0.1.0