Good day everyone! I have some problems with understanding baucis (https://github.com/wprl/baucis). In middleware section I found that request can have isAuthenticated() method, but I'm not found any information about it in documentation and I got mistakes when called it. I need to realize this method in my code by myself? My code:
var citySchema = new mongoose.Schema({
name: String
});
mongoose.model('City', citySchema);
var citiesController = baucis.rest('City');
citiesController.request(function (req, res, next) {
if (req.isAuthenticated()) return next();
return res.send(401);
});
Thanks for your question.
That is non-runnable example code. The passport middleware module adds the isAuthenticated
method to request, though with baucis you are free to use whatever authentication middleware you would like.
HTH!