简体   繁体   中英

Using Claims for Roles in ASP.NET Identity 2

I'm new in asp.net identity and perhaps don't understand concepts.

In my previous applications we have been able to create new roles and attach to roles objects which we called “Action”. Every action meant something what user who has a specific role can make. For instance, we created new role Role=Reader and Action=ReadNews. We set for user Mike what he in role Reader and then Mike could read news.

In new application we decided to use new authorization model from Asp.Net Identity 2 with Claims and escape from our actions. But in asp.net identity we don't attach claim (analog of our action) to roles easy. May be we need to think differently and use claims with another way?

I suggest to look at authorization policies from Asp.Net 5: Claims Transformation and Authorization Policy in ASP.NET 5 (vNext)/MVC 6 .

This will allow you to configure behavior based on roles. Implementation is opensource and I think it is possibel to port/implement it to curent framework. This will also help to migrate to new bits later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM