码迷,mamicode.com
首页 > 其他好文 > 详细

Why does my Authorize Attribute not work?

时间:2017-02-15 00:34:56      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:cti   this   pos   rect   lead   ati   roles   sed   imsi   

the roles of a ClaimsPrincipal are actually just claims create with a type of ClaimsIdentity.RoleClaimType. By default, this is given by ClaimType.Role, which is the string http://schemas.microsoft.com/ws/2008/06/identity/claims. When a user is authenticated appropriate claims are added for their roles which can be found later as required.

It‘s worth bearing this in mind if you have difficult with AuthorizeAttributes not working. Most external identity providers will use a different set of claims representing role, name etc that do not marry up with the values used by Microsoft in the ClaimType class. As Dominick Baier discusses on his blog, this can lead to situations where claims are not translated and so users can appear to not be in a given role. If you run into issues where your authorisation does not appear to working correctly, I strongly recommend you check out his post for all the details.

 

http://andrewlock.net/introduction-to-authorisation-in-asp-net-core/

https://leastprivilege.com/2016/08/21/why-does-my-authorize-attribute-not-work/

Why does my Authorize Attribute not work?

标签:cti   this   pos   rect   lead   ati   roles   sed   imsi   

原文地址:http://www.cnblogs.com/lyson/p/6399674.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!