" /> " /> "/>

Can I use the authorization rule (web.config) with Identity

138 Views Asked by At

I am migrating an old application that use the SqlMemberShipProvider and have a lot of authorization rules. e.g.

<location path="test/Technical.html">
    <system.web>
      <authorization>
        <allow roles="Technical" />
        <deny users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="test/Admin.html">
    <system.web>
      <authorization>
        <allow roles="Admin" />
        <deny users="*" />
      </authorization>
    </system.web>
  </location>

And am migrating to the new IdentityProvider, does the Identity Provider recognize the old rules from web.config ?

1

There are 1 best solutions below

0
Muhammad Adeel Zahid On

I haven't tried it with Identity yet but I have reason to believe that your mentioned web.config settings should work with Identity as well. Because Identity framework uses ClaimsPrincipal object which implements the old Iprincipal interface and it is IPrincipal which has the implementation of IsInRole method. I believe that this method is used to get the required functionality.