在openId授权代码流中使用最新版本的Katana DLL自动兑换代码(授权代码) [英] Automatic code( authorization code ) redemption using latest version of Katana DLLs in openId authorization code flow

查看:105
本文介绍了在openId授权代码流中使用最新版本的Katana DLL自动兑换代码(授权代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从下面的最新版本和下面的讨论中可以看出,Katana(4.1.0)现在支持具有自动代码赎回功能的代码流(这意味着我们没有显式调用tokenendpoint来赎回idtoken,accesstoken等代码)

From the recent release and conversation below, it says that now Katana(4.1.0) supports code-flow with automatic code redemption(that meaning we do not have call tokenendpoint explicitly to redeem the code for idtoken, accesstoken etc)

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

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

so, I've upgraded Katana dlls and have 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);
    }

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

and Im expecting middleware to call the token endpoint to redeem the auth code, which doesn't happen.

我在这里错过了什么吗?我应该在这里添加一些代码以便中间件兑换代码吗?请咨询..

Am I missing something here? should I add some code here for the middleware to redeem the code? Please advsie..

更新:

与其他博客一样,我在下面设置了

I have set below as per other blogs,

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

still midleware不会自动兑换代码.

still midleware does not redeem codes automatically.

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

Just a thought, is this supported on in .NET core? Im actually using .NET Framework 4.7.1.

推荐答案

实际上,以上设置可以正常工作,并且可以进行令牌api调用,但是由于"clientsecret"而导致的失败因我的设置而丢失,一旦更正,一切都可以正常进行.谢谢.

Actually, the above settings were working and making token api call, but failing due to "clientsecret" was missing in my settings, once corrected everything worked just fine.Thank you.

这篇关于在openId授权代码流中使用最新版本的Katana DLL自动兑换代码(授权代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆