【发布时间】:2016-06-07 22:49:50
【问题描述】:
我有类似的问题:https://github.com/IdentityServer/IdentityServer3.Samples/issues/9
但解决方案对我没有帮助。
那么让我们用图片和代码更详细地解释一下:
我在客户端上有这个:
无需映射,因为 NameClaimType(RoleClaimType) 和声明列表中的声明相同
JwtSecurityTokenHandler.InboundClaimTypeMap.Clear();
在 Api 项目上我有:
在这种情况下(如果我理解正确的话),我必须映射,因为 NameClaimType 和 RoleClaimType 与声明值不同。
JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>
{
{"role", System.Security.Claims.ClaimTypes.Role},
{"name",System.Security.Claims.ClaimTypes.Name }
};
但仍然无法正常工作。我做错了什么?
【问题讨论】:
标签: c# asp.net-web-api thinktecture-ident-server