【问题标题】:How to redirect/post from Owin OpenId Connect notifications?如何从 Owin OpenId Connect 通知重定向/发布?
【发布时间】:2016-05-15 10:20:24
【问题描述】:

我将 Owin OpenId Connect 中间件与 Thinktecture Identity Server 4 一起使用。

我正在通过本教程构建身份验证:https://www.scottbrady91.com/Identity-Server/Identity-Server-3-Standalone-Implementation-Part-3

我的应用正在通过混合流对 Identity Server 进行身份验证,一切正常。 与示例的不同之处在于,一旦我从 Identity Server 和所有令牌获得响应,我就不想实际登录到正在使用该中间件的应用程序。相反,我想将这些参数传递给其他应用程序并在那里登录用户。此中间件应用程序应仅充当 Identity Server 和实际应用程序(客户端)之间的中间人。

我想知道整个管道中的哪个通知最适合放置重定向以及如何实际放置

Startup.cs:

app.UseOpenIdConnectAuthentication(
            new OpenIdConnectAuthenticationOptions
            {           

                /* Some parameters */                    
                Notifications =
                    new OpenIdConnectAuthenticationNotifications
                    {   
                        MessageReceived = async n =>
                        {
                            //
                        },                            
                        AuthorizationCodeReceived = async n =>
                        {                                
                            //
                        },

                        SecurityTokenValidated = async n =>
                        {
                            //

                        }, 

                        RedirectToIdentityProvider = async n =>
                        {                                
                            //
                        }

                    }
            });

【问题讨论】:

    标签: asp.net owin openid-connect identityserver3


    【解决方案1】:

    这取决于您要在哪里对来自 IDP 的工件进行验证。 MessageReceived 在运行时确定已收到格式正确的 OIDC 消息后触发。 SecurityTokenValidated 在 id_token(如果它在消息中)被验证后被触发。 AuthorizationCodeReceived 将在 SecurityTokenValidated 之后触发,这是您将“代码”兑换为“access_token”的机会。如果您要兑换“代码”,则涉及秘密,这可能会发挥作用。 RedirectToIdentityProvider 在启动授权流程时很有趣,所以没意思。

    最有可能:MessageReceived 或 SecurityTokenValidated。

    【讨论】:

      猜你喜欢
      • 2020-05-19
      • 1970-01-01
      • 2015-02-16
      • 2021-01-09
      • 1970-01-01
      • 2022-10-19
      • 2016-12-18
      • 2016-01-05
      • 1970-01-01
      相关资源
      最近更新 更多