How to use Windows authentication with roles using Hot Towel?

I can deploy the standard asp.net mvc 4 intranet project and decorate the controller or methods with things like:

[System.Web.Mvc.Authorize(Roles = "MyApp Users")]

I tested it and it will work perfectly (since my domain account is a member of "MyApp Users" in Active Directory)

However, my problem / question is, how do I get the same type of behavior for the Hot Towel app ? I am trying to decorate my breeze controller, HotTowel controller or any method with the same attribute, and I can never authenticate ... what gives?

Your help is greatly appreciated.

+5
source share
1 answer

. , .

WindowsProvider roleManager :

<roleManager defaultProvider="WindowsProvider"
   enabled="true"
   cacheRolesInCookie="false">
  <providers>
    <add
      name="WindowsProvider"
      type="System.Web.Security.WindowsTokenRoleProvider" />
  </providers>
</roleManager>

[ Roles.IsUserInRole()], authorize. , authorize, :

[System.Web.Mvc.Authorize(Roles = "YourDomain\\MyApp Users")]

, .

+5

All Articles