什么是req.isAuthenticated()passportJS
在PassportJS Documention中,我认为护照authenticationfunction没有很好的logging。
我想问,什么passport.isAuthenticated()ID做?
对于任何请求,您可以检查用户是否通过身份validation或使用此方法。
app.get('/some_path',checkAuthentication,function(req,res){ //do something only if user is authenticated }); function checkAuthentication(req,res,next){ if(req.isAuthenticated()){ //if user is looged in, req.isAuthenticated() will return true next(); } else{ res.redirect("/login"); } }
- 使用Node / Express构build企业应用程序
- Angular / Node / Express / Passport跨域问题 – 启用CORS Passport Facebook身份validation
- 如何在Raspberry Pi上安装最新版本的node.js?
- Express Static中间件自动提供index.html
- Mongoose getter / setter用于标准化数据
- 如何使用gulp在不同的文件中创buildTypescript源代码,而不是在JavaScript文件中?
- 科多瓦钩:停止节点,直到承诺完成
- 如何从CoffeeScript脚本中启动CoffeeScript repl?
- 从Lambda函数(Node)连接到MySQL数据库
- 客户端模块工作stream程:(Browserify + npm + gulp)或(RequireJS + Bower + gulp)?
- 在Windows 7 x64(NodeJS jQuery)下构build竞争对手