MVC5 Claims version of the Authorize attribute

后端 未结 5 680
情书的邮戳
情书的邮戳 2020-11-29 16:39

I\'m trying out some of the new stuff in VS2013 RC with MVC5 and the new OWIN authentication middleware.

So, I\'m used to using the [Authorize] attribut

5条回答
  •  伪装坚强ぢ
    2020-11-29 17:01

    1. You wouldn't check for claims specifically, but rather for action/resource pairs. Factor out the actual claims / data checks into an authorization manager. Separation of concerns.
    2. MVC and ClaimsPrincipalPermission is not a good match. It throws a SecurityException and is not unit testing friendly.

    My version is here: http://leastprivilege.com/2012/10/26/using-claims-based-authorization-in-mvc-and-web-api/

提交回复
热议问题