【问题标题】:Update System.IdentityModel.Tokens.Jwt 4.0.2 to 5.4 Token Issues将 System.IdentityModel.Tokens.Jwt 4.0.2 更新到 5.4 令牌问题
【发布时间】:2019-03-13 10:25:17
【问题描述】:

我正在尝试将我的代码从 System.IdentityModel.Tokens 4.0.2 更新到最新版本 5.4,但我遇到了一些我无法弄清楚的错误。

app.UseActiveDirectoryFederationServicesBearerAuthentication(
        new ActiveDirectoryFederationServicesBearerAuthenticationOptions
        {
            MetadataEndpoint = "MetadataEndpoint",
            TokenValidationParameters = new TokenValidationParameters()
            {
                ValidAudience = "Audience",
                ValidIssuer = "Issuer"
            }
        }

TokenValidationParameters 不再有效。

app.UseJwtBearerAuthentication(
            new JwtBearerAuthenticationOptions
            {
                AuthenticationMode = AuthenticationMode.Active,
                AllowedAudiences = new[] { audienceId },
                IssuerSecurityTokenProviders = new IIssuerSecurityTokenProvider[]
                {
                    new SymmetricKeyIssuerSecurityTokenProvider(issuer, audienceSecret)
                }
            }); 

IssuerSecurityTokenProviders 也不可用。

有人遇到过同样的问题吗?任何指针。

【问题讨论】:

    标签: c# jwt


    【解决方案1】:

    您会遇到this 的问题吗?

    5.x 与 Katana 3 不兼容 - 它适用于未来的 .NET Core。你需要留在 4.x

    【讨论】:

    • 我不认为是同一个问题,因为我们注意到使用 Katana 3。但他们和我们现在有类似的问题。它可能解决我的问题的另一件事是找到一种方法来使用 System.IdentityModel.Tokens.Jwt 4.0.2 上的密钥解密令牌,版本 5 不支持我在其他项目中使用的代码
    猜你喜欢
    • 2017-11-14
    • 1970-01-01
    • 2017-09-13
    • 2022-01-08
    • 1970-01-01
    • 2020-09-12
    • 1970-01-01
    • 2020-03-24
    • 2013-09-11
    相关资源
    最近更新 更多