asp.net-core - 当您在回调页面中并且用户想要取消注册时如何从外部提供商注销
问题描述
当您在回调页面中并且用户想要取消注册时如何从 Saml 外部提供商注销
注意:用户尚未注册,他只是输入外部提供商凭据并重定向到我的 IDP 以输入附加数据,我想添加操作以能够注销并取消注册过程。
注销代码
var vm = await BuildLoggedOutViewModelAsync(model.LogoutId);
if (User?.Identity.IsAuthenticated == true)
{
// delete local authentication cookie
await HttpContext.SignOutAsync();
// raise the logout event
await _events.RaiseAsync(new UserLogoutSuccessEvent(User.GetSubjectId(), User.GetDisplayName()));
}
// check if we need to trigger sign-out at an upstream identity provider
if (vm.TriggerExternalSignout)
{
// build a return URL so the upstream provider will redirect back
// to us after the user has logged out. this allows us to then
// complete our single sign-out processing.
string url = Url.Action("Logout", "Account", new { Area = "Identity", logoutId = vm.LogoutId });
// this triggers a redirect to the external provider for sign-out
return SignOut(new AuthenticationProperties { RedirectUri = url }, vm.ExternalAuthenticationScheme);
}
return RedirectToPage("Login");
解决方案
答案只是在当前上下文中设置用户,因此 saml2 可以读取所需的数据以进行重定向
Request.HttpContext.User = info.Principal;
推荐阅读
- hadoop - Sqoop 命令在 RDBMS 中删除表
- android - 拒绝对先前失败的类 java.lang.Class 重新初始化
支持库=28 - excel-formula - Excel - 仅使用每行和列一次在表中查找最高和的函数
- angular - agGrid Angular - 在行、列上添加元素(图标)
- amazon-web-services - 如何在 AWS 上连接安装并连接到 GUI SUSE
- python - xgboost 分类变量的特征重要性
- python-3.x - numpy busday_count for Days 的差异给出了 TypeError: dtype('
我正在尝试计算两个日期之间的天数,但出现错误
TypeError: ("Iterator operand 0 dtype could not be cast from dtyp
- bash - 为什么我得到“找不到函数”Bash Shell 脚本
- javascript - 自动播放视频开始时间与时钟时间相同
- swift - 无法将“__NSCFSet”(0x109b56408)类型的值转换为“NSArray”Swift 4