8
在我的ASP.NET MVC 4應用程序中,我使用Intranet模板來實現Windows身份驗證。我也在使用Fluent Security。如何在ASP.NET MVC 4中將域組用作流暢安全的角色?
開箱即用,我可以使用下面顯示的註釋來限制對控制器方法對特定域組或域用戶的訪問。
[Authorize([email protected]"Domain\GroupName")]
public ActionResult Index()
{
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
return View();
}
[Authorize([email protected]"Domain\UserName")]
public ActionResult About()
{
ViewBag.Message = "Your app description page.";
return View();
}
如何將這兩種方法限制在使用Fluent Security的相同域組和域用戶?如果這更容易,我對用戶羣比用戶更感興趣。我是否需要制定自定義政策?如果是這樣,我不太清楚如何檢查經過身份驗證的用戶是否在域組中以便爲Fluent Security返回適當的角色以供使用?
我已經通過FluentSecurity入門,所以我知道如何實現FluentSecurity的基礎知識,我只是不確定如何使用域組作爲角色。
謝謝!