Search code examples
c#asp.net-coreasp.net-core-identityasp.net-authorization

Asp.net Core Identity Claims Vs Roles Based Authorization


What is the difference between role Authorization and claim Authorization and when should I use one of them in Asp.net Core Identity?


Solution

  • Role base authorization is to support existing applications and for backward compatibility. Claims authorization is for future, it gives flexibility to design systems based on the claims for the user. As you may know, claims are key-value based. We can have authorization rules to verify if the claims exists for the user (OR) the claim has a specific value. In role-based, it can imagined by having a separate role for each set of authorization rules.