在openId授权代码流中使用最新版本的Katana DLL自动兑换代码(授权代码)

时间:2020-01-29 10:30:06

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

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

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

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

@Async
public void myAsyncMethod() {

}

以及此处的实现

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);
    }

仍然Midleware不会自动兑换代码。

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

1 个答案:

答案 0 :(得分:2)

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