当请求的键值对 scopes
没有 API 资源(但其他资源如身份资源)时,为什么 ProfileDataRequestContext.RequestedClaimTypes
为 null - openid、个人资料、电话等)
为什么它们不被算作“已请求”?那么,人们如何知道要在即将生成的 JWT 中包含哪些声明呢?
显然,如果我请求 API 资源,并且我的所有声明都列在 UserClaims
属性下,则一切都会按预期进行。 (其中列出的声明将添加到 requestedClaimTypes
集合中。)
谢谢!
最佳答案
ProfileService 在 token 创建时被调用,但具有不同的上下文:
Context.Caller = ClaimsProviderAccessToken
Context.Caller = UserInfoEndpoint
所以这取决于生成 token 的类型。
对于访问 token ,仅允许资源范围 (ApiResources),对于返回的身份 token ,仅允许身份范围 (IdentityResources)。
尽管默认情况下 id_token 将仅包含 sub
声明。可以在 UserInfo 端点请求更多信息。
关于c# - 请求 API 资源以外的范围时,ProfileDataRequestContext.RequestedClaimTypes 始终为 null?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60003197/