c# - Office365 单点注销
问题描述
我在现有的 C# Asp.Net MVC 4.5 应用程序中实现了单点登录,因此使用了 Owin 中间件和 OpenIdConnectAuthentication。身份验证和授权工作正常,但现在我遇到以下问题:
- 我使用 AzureAD 作为身份提供者登录到我的应用程序
- 我在另一个浏览器选项卡中登录 Office365
- 我退出我的应用程序 - 被重定向到身份提供者并自动在那里退出
- 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);
解决方案
推荐阅读
- sql - StreamSets - 如何在 JDBC 生产者之后调用调用 JDBC 查询
- mysql - 根据第三个表的数据连接两个表
- logging - Azure 数据工厂 - 查找活动 - 如何访问错误数据?(SQL 错误)
- active-directory - 设置 ACL 非管理员用户
- slurm - 您将如何检查 SLURM 或 MOAB/Torque 在环境中是否可用?
- node.js - 用于使查询搜索不起作用的 API
- css - is :where 意味着折叠重复的选择器?
- java - 如何在 Microstream 中正确使用 BinaryHandler 来存储易失的 long 数组?
- javascript - 为什么我从 AJAX 登录表单提交中获取 $_POST['variable'] 的数组
- powershell - Powershell脚本 - 替换文件中的文本