【问题标题】:IdentityServer offset in identity claim身份声明中的 IdentityServer 偏移量
【发布时间】:2017-02-11 17:27:52
【问题描述】:

给定

身份服务器允许 RessourceOwner 和混合流。 Hybrid 流集成在网站中,RessourceOwner 流由 api 使用。

当我使用 hybrid flow 登录时,我可以看到有一个主题声明,其中包含主题/ID 数据。

当我通过 ressourceowner 进行身份验证时,我可以在 claimprincipal 中看到 id 是在

中设置的
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier

哪里有偏移量?这是否表明我编码错误?或者这是预期的行为,如果是,为什么?

-- 更新

api中的配置

 app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
            {
                Authority = identServer
            });

IdentityServer 中的外部身份验证配置

 var fb = new FacebookAuthenticationOptions
            {
                AuthenticationType = "Facebook",
                Caption = "Facebook",
                SignInAsAuthenticationType = signInAsType,
                AppId = "43543534543534534",
                AppSecret = "sad345345345345354"
            };
            app.UseFacebookAuthentication(fb);

identityServer 中的客户端配置

 return new Client
            {
                Enabled = true,
                ClientId = "pluto",
                ClientName = "Pluto Site",
                ClientSecrets = new List<Secret>
                {
                    new Secret("foo".Sha256())
                },
                Flow = Flows.ResourceOwner,
                AllowedScopes = new List<string>
                {
                    Constants.StandardScopes.OpenId,
                    "read"
                }
            };

【问题讨论】:

  • 对我来说听起来像是 JWT 处理程序配置问题。 leastprivilege.com/2016/08/21/…
  • 抱歉看不到你写的关于 OpenIdConnectOptions 的链接帖子的关系,但目前我只有 IdentityServerBearerTokenAuthenticationOptions。我错过了什么吗?我还在我的初始帖子中添加了配置代码。
  • 我也尝试在 api 配置中设置 NameClaimType = "subject",但没有任何改变
  • @leastprivilege 找到。不确定它的文档部分是否可能我过度阅读了它。我只是错过了清除错误声明类型映射

标签: asp.net-identity identityserver3


【解决方案1】:

原因是我错过了清除默认映射.. 它是教程的一部分,但从未解释过为什么......

JwtSecurityTokenHandler.InboundClaimTypeMap.Clear();

【讨论】:

    猜你喜欢
    • 2015-04-20
    • 2015-06-20
    • 2016-03-01
    • 2016-07-31
    • 2021-03-24
    • 1970-01-01
    • 2021-08-26
    • 1970-01-01
    • 2016-02-19
    相关资源
    最近更新 更多