ASP .NET MVC Forms authorization with Active Directory groups

前端 未结 2 1332
悲哀的现实
悲哀的现实 2020-11-29 17:38

I\'m attempting to authenticate using users and groups in ASP.NET MVC against Active Directory.

I have put the following attribute on all my classes (except the acco

2条回答
  •  庸人自扰
    2020-11-29 18:15

    It's no longer necessary to implement your own attribute for this functionality in ASP.NET MVC 3. The AspNetWindowsTokenRoleProvider works with Active Directory users and groups. To use this with AuthorizeAttribute you need to add the following to your web.config:

    
    
    
       
          
          
       
    
    

    Then, on your controllers or action methods, you can refer to Active Directory Groups like so:

    [Authorize(Roles = "YOURDOMAIN\\Group1, YOURDOMAIN\\Group2")]
    

提交回复
热议问题