【发布时间】:2021-03-14 12:26:00
【问题描述】:
我有一个受 Identity Server 保护的 MVC 客户端应用程序 (APP1)。一旦用户注销 idsrv,我就使用反向通道机制注销客户端。和这个很相似:https://github.com/IdentityServer/IdentityServer4/blob/main/samples/Clients/src/MvcHybridBackChannel/Startup.cs
现在的问题是:我需要添加对外部提供商 Azure AD 的支持。反过来,它也应该支持自动注销:当用户从 Azure AD 注销时,他应该从 idsrv 和客户端应用程序中注销。
我的第一个想法是实现相同的方法:Azure 应用注册支持在注销时调用客户端端点的能力。但是当我需要设置自定义 CookieAuthenticationEvents 时,我正在努力解决这个问题。我在客户端应用程序 APP1 中的代码:
services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
}).AddCookie("Cookies", options =>
{
options.EventsType = typeof(CookieEventHandler);
}
但相同的代码在 idsrv 中不起作用。但这我的意思是我的 cookie 没有被我的自定义 CookieEventHandler 验证。谁能指出我正确的方向?
【问题讨论】:
标签: asp.net-mvc asp.net-core identityserver4