2

I am trying to make the best use of Identity Core. In Identity, I am seeing, there are 7 tables like this-

Identity Tables

In there, I am curious about this table-

RoleClaim Table

Which can be found in here.

I am trying to use this table for claim based authentication where Super Admin can assign claims onto any role. So that Roles could be dynamic. So, what I am thinking is something like this-

ERD

But there is no table exists named Claim or close to this.

That is why I am thinking I have some gap in my knowledge. But there is no clear documentation known to me on this topic as far as I have found.

Can anyone please let me know,

  1. How can I add an entry to the RoleClaim table?
  2. Why there is no Claim table in Identity?
  3. Is there any clear documentation regarding this?

I have found one close to my need, but I am not sure. The doc can be found in here and here. Thanks in advance for helping.

Re-

If needed, my total code can be found in here.

Abrar Jahin
  • 13,970
  • 24
  • 112
  • 161

1 Answers1

0

1.How can I add an entry to the RoleClaim table?

var accountRole = await _roleManager.FindByNameAsync("Admin");

await _roleManager.AddClaimAsync(accountRole, new Claim("Manage", "Cashier"));

Reference:

https://stackoverflow.com/a/53332171/11398810

2.Why there is no Claim table in Identity?

This is by design.I think you need to raise question in github to ask for PG for help.

Reference:

https://github.com/dotnet/aspnetcore/issues

3.Is there any clear documentation regarding this?

There seems to be no official document to explain them.

Rena
  • 30,832
  • 6
  • 37
  • 72