首页 > 解决方案 > 使用 Oidc-Client 自定义声明 IdentityServer4 和 Angular5

问题描述

我将 identityserver4 与 aspnetIdentity 一起用于用户管理

从 AccountController(示例代码) - 调用登录方法并返回令牌但令牌不包含任何声明,我也实现了 IprofileService 但端点从未被命中。在数据库中 - 我为该 IdentityResource 添加了 IdentityResource,Identityclaims 并使用 alwaysincludeClaimsinToken 标记客户端

在 IdentityServer IProfile 服务中添加了一些示例中给出的但是所有这些都没有调用 Profileservice 并且除了标准 id_token 信息之外没有任何信息添加到令牌中 请让我知道我错过了什么

标签: identityserver4claims

解决方案


我发现 Iprofileservie 实现不适用于 localhost 配置,而在实际服务器上部署时同样有效。我向 ASNEtUSers 添加了属性。添加了 IdentityResource 和 IdentityResourceClaim 数据,如果客户端动态询问,则在 Profileservice 中添加声明。


推荐阅读