【发布时间】:2017-12-03 18:00:38
【问题描述】:
我正在研究当用户在身份服务器的部署上执行注销时(例如http://localhost:5000),如何断开当前登录 mvc 客户端的用户(例如http://localhost:5001)
我知道在 identityserver4 中有一个 OAuth2 的实现可以做到这一点(https://openid.net/specs/openid-connect-backchannel-1_0.html 和 https://openid.net/specs/openid-connect-frontchannel-1_0.html)
对我来说幸运的是,Brock Allen 在不到一天前刚刚对样本进行了更改:https://github.com/IdentityServer/IdentityServer4.Samples/issues/197
但是,此时示例要么不完整,要么我遗漏了一些东西。
在我的服务器上,我将 FrontChannelLogoutUrl 的值设置为 http://localhost:5001/frontchannello,并将那段代码添加到我的 mvc 客户端(基本上是从示例中窃取的):
[HttpGet("frontChannello")]
public IActionResult FrontChannelLogout(string sid)
{
if (User.Identity.IsAuthenticated)
{
var currentSid = User.FindFirst("sid")?.Value ?? "";
if (string.Equals(currentSid, sid, StringComparison.Ordinal))
{
//await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
return new SignOutResult(new[] { "Cookies", "oidc" });
}
}
return NoContent();
}
该代码永远不会被调用。
所以我的问题是:我应该使用反向通道还是前端通道?以及如何实现它
【问题讨论】:
标签: identityserver4