首页 > 解决方案 > Office365 单点注销

问题描述

我在现有的 C# Asp.Net MVC 4.5 应用程序中实现了单点登录,因此使用了 Owin 中间件和 OpenIdConnectAuthentication。身份验证和授权工作正常,但现在我遇到以下问题:

  1. 我使用 AzureAD 作为身份提供者登录到我的应用程序
  2. 我在另一个浏览器选项卡中登录 Office365
  3. 我退出我的应用程序 - 被重定向到身份提供者并自动在那里退出
  4. Office365 在另一个选项卡中自动注销

我没有配置单点注销(所以我没有在应用注册中指定注销 URL,也没有在配置代码中指定),但我仍然退出了 Office365。这对客户来说很烦人,因为他总是在浏览器中使用 Outlook365。

如何防止 Office365 自动注销用户。

这是我的 OpenIdConnect 配置的简化代码:

app.UseOpenIdConnectAuthentication(
            new OpenIdConnectAuthenticationOptions
            {
                ClientId = clientId,
                Authority = authority,
                Notifications = new OpenIdConnectAuthenticationNotifications
                {
                    AuthorizationCodeReceived = (context) =>
                    {
                        // ... my sign in logic ...
                        context.OwinContext.Response.Redirect(homeUrl);
                        return Task.FromResult(0);
                    },
                },
                AuthenticationType = OpenIdConnectAuthenticationDefaults.AuthenticationType
            });

这是我退出应用程序的方式:

context.GetOwinContext().Authentication.SignOut(new AuthenticationProperties { RedirectUri = redirectUrl }, OpenIdConnectAuthenticationDefaults.AuthenticationType);

标签: c#authenticationmodel-view-controllersingle-sign-onowin

解决方案


推荐阅读