我是SailsJS的新手,我想問專家的意見,我的實施是否可以。在SailsJS的passport authentication package的幫助下,我能夠獲得某種認證。Sails JS護照認證製作策略層無用?
/controller/members.js:
module.exports = {
//deny all non authenticated users from accessing this controller
'*':function(req,res,next){
if(!req.user){
res.view(403);
}else{
next();
}
},
//once user is authenticated through passport, it is redirected here
'welcome':function(req,res){
res.view();
},
//when user clicks logout
'logout':function(req,res){
req.logout();
res.redirect("/login");
},
};
然而,正如你可以從這個看到,進入策略控制器本身內編碼。我根本不使用策略。那麼在包的幫助下,SailsJS中的策略層是完全沒有用的?這是實施passportJS的正確方式嗎?糾正我,如果我錯了,我想我絕對是。
我想用由kasperisager提供的包,因爲它具有「魔力」它將所有登錄方法(通過社交)捆綁在一起並保留單個用戶標識。 – holyxiaoxin 2014-11-04 08:55:25
對不起。沒有關於這個特定的npm包的線索。爲什麼不嘗試在Github回購中提出問題? – amarprabhu 2014-11-08 09:16:53