Search code examples
c#asp.netweb-configclaims-based-identityasp.net-authorization

Web.Config authorization using claims instead of roles asp.net


I have been using a tool that manages asp.net identities so that I can configure/add users, roles etc. For authorization.

My initial notion is that I was going to be easily able to restrict access to pages using roles through the following means.

<location path="Insert">
    <system.web>
      <authorization>
        <allow roles="Admin, CurrencyUser"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>

However, I've since learned that this tool has been making these "roles" as claims instead of roles, and that apparently it won't be nearly as simple as this.

Please tell me there is a similarly simple way of authorizing against claims (aspnetuserclaims) as opposed to roles (aspnetroles). I'm including a picture of the database asp.net authentication made by default, using the asp web forms template.

Documentation and tutorials are so hard to find it's maddening, I appreciate very much any help given. The simpler the solution the better.

enter image description here


Solution

  • These days, we don't normally see new application developing in ASP.NET Web Form. So, it is hard to find articles explaining how to use Identity in ASP.NET Web Form.

    ASP.NET Identity normally goes hand in hand with ASP.NET Core/MVC. The following three PluralSight Training help me understand ASP.NET Identity -

    1. ASP.NET Core Fundamentals by Scott Allen

    2. Understanding ASP.NET Core Security by Roland Guijt

    3. Leveraging Common Middleware Packages by Gavin Lanata

    Note: I'm not affiliated to PluralSight or any of those authors.