使用OpenIDConnect的Azure AD身份验证后无法解决无限循环问题-授权代码授予

时间:2020-01-01 09:46:17

标签: asp.net-mvc-5 azure-active-directory infinite-loop openid-connect

我们正在使用Open ID Connect在ASP.NET MVC 5中实现Azure AD身份验证。当应用程序在内部运行时,我们具有Windows身份验证,因此没有登录页面或登录按钮。

我们已将[Authorize]属性赋予所有控制器,以便在访问页面之前对用户进行身份验证。下面是启动Auth中的代码。

    app.UseKentorOwinCookieSaver();
        app.UseCookieAuthentication(new CookieAuthenticationOptions
        {
            AuthenticationType = "Cookies",
            CookieManager = new Microsoft.Owin.Host.SystemWeb.SystemWebChunkingCookieManager()
        });
        app.UseOpenIdConnectAuthentication(
            new OpenIdConnectAuthenticationOptions
            {
                ClientId = clientId,
                Authority = authority,
                PostLogoutRedirectUri = postLogoutRedirectUri,
                RedirectUri = RedirectUri,
                ResponseType = OpenIdConnectResponseType.Code,
                Notifications = new OpenIdConnectAuthenticationNotifications()
                {

                    AuthenticationFailed = (context) => {
                        context.HandleResponse();
                        return Task.FromResult(0);
                    }
                }

            }); 

但是,一旦用户通过身份验证,我们将面临无限循环。我尝试了Internet上的所有解决方案,但问题没有解决。

https://stackoverflow.com/a/37666371/55775

https://github.com/Sustainsys/owin-cookie-saver

https://github.com/aspnet/AspNetKatana/wiki/System.Web-response-cookie-integration-issues

ASP.NET_SessionId + OWIN Cookies do not send to browser

asp.net mvc azure AAD authentication infinite loop

0 个答案:

没有答案