Add Model.requireToken, default swagger to false

This commit is contained in:
Ritchie Martori 2013-12-06 12:00:18 -08:00
parent 1ba114ecda
commit 4c69af5ae2
1 changed files with 12 additions and 1 deletions

View File

@ -186,7 +186,10 @@ app.enableAuth = function() {
}
}
);
} else if(method.fn && method.fn.requireToken === false) {
} else if(
Model.requireToken === false ||
method.fn && method.fn.requireToken === false
) {
next();
} else {
var e = new Error('Access Denied');
@ -282,6 +285,14 @@ app.boot = function(options) {
}
}
// disable token requirement for swagger, if available
var swagger = app.remotes().exports.swagger;
var requireTokenForSwagger = appConfig.swagger
&& appConfig.swagger.requireToken;
if(swagger) {
swagger.requireToken = requireTokenForSwagger || false;
}
// require directories
var requiredModels = requireDir(path.join(appRootDir, 'models'));
}