【问题标题】:Missing Claims and Identity Info with IdentityServer v3IdentityServer v3 缺少声明和身份信息
【发布时间】:2015-04-20 03:51:01
【问题描述】:

我有 IdentityServer 和 Membership Reboot 和 IdentityManager 在远程服务器上运行,我使用 IdentityManager 的管理 UI 来设置用户,并向所述用户添加角色和声明。

我正在开发一个使用远程服务器进行身份验证的 WebApi/SPA 项目。使用提琴手,我可以从远程盒子上的 IdentityManager 请求一个令牌,并使用这个令牌来对抗需要授权的本地 WebApi。如果令牌有效,WebApi 会像往常一样处理,如果令牌是伪造的,我会得到 401。效果很好。

问题是,当我想要有关用户的其他信息时,没有任何声明或身份信息会出现。我不确定问题是在 IdentityServer 端、WebApi 端,还是在获取令牌时我没有正确执行某些操作。

【问题讨论】:

    标签: asp.net-web-api claims-based-identity thinktecture-ident-server membershipreboot thinktecture


    【解决方案1】:

    我没有意识到我们需要将声明放在范围定义中。以防其他人偶然发现这一点,我将范围更改为以下

       var scopes = new List<Scope>
        {
            new Scope
            {
                Enabled = true,
                Name = "publicApi",
                Description = "Access to our public API",
                Type = ScopeType.Resource,
                IncludeAllClaimsForUser = true, //I'll filter this down later
            }
        };
        scopes.AddRange(StandardScopes.All);
    
        return scopes;
    

    更多详情可查看here

    【讨论】:

      猜你喜欢
      • 2017-02-11
      • 2017-09-09
      • 2018-03-27
      • 1970-01-01
      • 2018-08-01
      • 2023-03-22
      • 2016-05-04
      • 1970-01-01
      • 2020-06-11
      相关资源
      最近更新 更多