1
在我的Orchard模塊中,我正在考慮用對Authorizer.Authorize()的調用來替換我的控制器操作中的MVC的AuthorizeAttribute。好處是,如果用戶無權訪問頁面,我可以重定向回主頁,因此不會告訴他們這是一個身份驗證問題。授權屬性v Authorizer.Authorize
是否有使用這個任何安全問題:
public ActionResult Edit(int id) {
if (!_authorizer.Authorize(Permissions.MyPermission))
return Redirect("~/");
// do stuff here and return
}
,而不是這樣的:
[Authorize]
public ActionResult Edit(int id) {
// do stuff here and return
}
完整性檢查是最讚賞。
第一個允許你利用Orchard的權限系統,這在vanilla MVC中是不可用的,所以我會選擇 – Hazza