[英]Baucis + Node.js
Good day everyone! 今天是个好日子! I have some problems with understanding baucis ( https://github.com/wprl/baucis ).
我在理解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.
在中间件部分,我发现请求可以具有isAuthenticated()方法,但是在文档中找不到有关该信息的任何信息,调用该函数时会出错。 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. 护照中间件模块添加了
isAuthenticated
方法来请求,尽管使用baucis,您可以自由使用所需的任何身份验证中间件 。
HTH! HTH!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.