【问题标题】:Automatic code( authorization code ) redemption using latest version of Katana DLLs in openId authorization code flow在 openId 授权代码流中使用最新版本的 Katana DLL 自动兑换代码(授权代码)
【发布时间】:2020-05-14 20:03:27
【问题描述】:

从最近的发布和下面的对话中,它说现在 Katana(4.1.0) 支持带有自动代码兑换的代码流(这意味着我们没有显式调用 tokenendpoint 来兑换 idtoken、accesstoken 等的代码)

https://github.com/aspnet/AspNetKatana/pull/297

所以,我已经升级了 Katana dll 并拥有了 p

Notifications = new OpenIdConnectAuthenticationNotifications()
                {
                    RedirectToIdentityProvider = OnRedirectToIdentityProvider,
                    //MessageReceived = OnMessageReceived, -- previous I were calling token endpoint in this notification
                    SecurityTokenReceived = notification => Task.FromResult(0),
                    SecurityTokenValidated = OnSecurityTokenValidated,
                    AuthenticationFailed = OnAuthenticationFailed,
                    AuthorizationCodeReceived = AuthorizationCodeReceived, -- added this notification per latest improvements
                    TokenResponseReceived = TokenResponseReceived
                }

以及这里的实现

 private Task AuthorizationCodeReceived(AuthorizationCodeReceivedNotification arg)
    {
        return Task.FromResult(0);
    }

并且我希望中间件调用令牌端点来兑换身份验证代码,这不会发生。

我在这里遗漏了什么吗?我应该在此处添加一些代码以供中间件兑换代码吗?请多多指教。。

更新:

我在下面按照其他博客设置,

args.App.UseOpenIdConnectAuthentication(
                new OpenIdConnectAuthenticationOptions
                {
                   //other properties removed for brevity
                    SaveTokens = true,
                    RedeemCode = true,
}

中间件仍然不会自动兑换代码。

只是一个想法,.NET 核心是否支持此功能?我实际上使用的是 .NET Framework 4.7.1。

【问题讨论】:

    标签: asp.net owin openid-connect katana owin-middleware


    【解决方案1】:

    实际上,上述设置正在工作并进行令牌api调用,但由于我的设置中缺少“clientsecret”而失败,一旦更正一切正常。谢谢。

    【讨论】:

      猜你喜欢
      • 2017-06-28
      • 2018-05-20
      • 2015-12-11
      • 2015-02-02
      • 1970-01-01
      • 2021-02-17
      • 2021-05-08
      • 2014-11-04
      • 2017-04-20
      相关资源
      最近更新 更多