0
我正在关注post来实现IdentityServer4。我有在过程GetProfileDataAsync中的ProfileService中的问题IEnumerable context.RequestedClaimTypes为空。我应该在Postman中更改我的请求以请求某些索赔类型吗?我能做些什么,以便context.RequestedClaimTypes包含声明类型?如何请求IdentityServer4中的声明类型?
我的邮差请求如下所示:
Post http://localhost:57577/connect/token
Authorization: Basic Z2xvYmFsX2F...
Body (x-www-form-urlencoded):
username:[email protected]
password:pass
grant_type:password
scope:my_api
这几乎完全解决了我的问题。姓名和电子邮件在context.RequestedClaimTypes中可用,但主题仍不可用。我将JwtClaimTypes.Subject添加到UserClaims。我添加了“my_api”,“openid”,“profile”,“email”。在客户端,我添加了AllowedScopes:“my_api”,“openid”,“profile”,“email”,“sub”。在Postman中,作用域包含“my_api openid配置文件电子邮件”。 – Uros
默认情况下,JwtClaimTypes.Subject(“sub”)声明将包含在API中的User.Claims中。 – Uros