Mehedi Hasan Kajol
Mehedi Hasan Kajol

Reputation: 167

Can I assign claims to role and then assign roles to user in .NET Core?

We have four claims:

CanViewPosts, CanEditPosts, CanAddPosts, CanDeletePosts

Now, I want to create a role Moderator and assign two claims CanViewPosts, CanEditPosts to this role.

Then, I create a user with mail [email protected] and assign the Moderator role to this user.

I can assign roles to a user, but I want to dynamically assign claims to a role. Because, I will give multiple users, a same role.

How can I implement this in .NET Core 5 ?

Upvotes: 2

Views: 75

Answers (1)

Rajat Jha
Rajat Jha

Reputation: 91

yes you can assign claims and roles in identity server, if you are using identity server use claim type of role and claim value is CanViewPosts, CanEditPosts

Upvotes: 1

Related Questions