【问题标题】:How to perform an action before redirect in OpenID-Connect OWIN MVC如何在 OpenID-Connect OWIN MVC 中重定向之前执行操作
【发布时间】:2020-05-19 04:19:11
【问题描述】:

我尝试了几天,但无法弄清楚,如果有人可以帮助我,将不胜感激。

public void SignIn()
        {
            // Send an OpenID Connect sign-in request.
            if (!Request.IsAuthenticated)
            {

                //Perform some action if user is successfully authenticated??

                HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "https://localhost:44309/DummyController/DummyAction" }, OpenIdConnectAuthenticationDefaults.AuthenticationType);
            }

        }

【问题讨论】:

    标签: c# asp.net-mvc owin openid-connect


    【解决方案1】:

    实现动作 RedirectToIdentityProvider

      Notifications = new OpenIdConnectAuthenticationNotifications
                {
                    RedirectToIdentityProvider = OnRedirectToIdentityProvider
                }
    
       private Task OnRedirectToIdentityProvider(RedirectToIdentityProviderNotification<OpenIdConnectMessage, 
            OpenIdConnectAuthenticationOptions> arg)
        {
            throw new NotImplementedException();
        }
    

    【讨论】:

      猜你喜欢
      • 2016-05-15
      • 1970-01-01
      • 2021-01-09
      • 2015-02-16
      • 2012-11-25
      • 2019-08-04
      • 2016-04-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多