【发布时间】:2021-02-16 01:32:23
【问题描述】:
从身份服务器 4 成功注销后(我看到日志消息 AuthenticationScheme: idsrv signed out.),实际的访问令牌仍然有效。因此,有了这个访问令牌,我仍然可以访问我的 API。
我可以通过调用自己使这些令牌失效:
_persistedGrantService.RemoveAllGrantsAsync(logoutContext.SubjectId, null, logoutContext.SessionId);
但我想知道这是否是正确的方法,因为我期望通过调用 end_session_endpoint 来管理身份服务器。 是不是我做错了什么?
我的退出方法如下所示:
await HttpContext.SignOutAsync();
var logoutContext = await _interactionService.GetLogoutContextAsync(logoutId);
if (logoutContext == null)
{
return NotFound();
}
// Is this needed?
await _persistedGrantService.RemoveAllGrantsAsync(logoutContext.SubjectId, null, logoutContext.SessionId);
SignOutIframeUrl = logoutContext.SignOutIFrameUrl;
var externalIdp = await GetExternalIdpAsync();
if (externalIdp != null)
{
// 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.
var url = Url.Page("SignOut", new {logoutId});
// this triggers a redirect to the external provider for sign-out
return SignOut(new AuthenticationProperties {RedirectUri = url}, externalIdp);
}
if (logoutContext.PostLogoutRedirectUri != null)
{
return Redirect(logoutContext.PostLogoutRedirectUri);
}
return Page();
【问题讨论】:
标签: identityserver4 openid-connect