0
ログイン機能と別個のMVCClientを扱うIndentityServer4プロジェクトがありますが、MVCクライアントからのログアウト機能が必要ですが、これは単にMVCクライアントを持っている必要があります。IdentityServer4のログアウトを正しく処理する
public async Task Logout()
{
await HttpContext.Authentication.SignOutAsync("Cookies");
await HttpContext.Authentication.SignOutAsync("oidc");
}
が、identityserver4プロジェクトにもっとたくさんあるようですより複雑なログアウトがあります:
[HttpPost]
[ValidateAntiForgeryToken]
[AllowAnonymous]
public async Task<IActionResult> Logout(LogoutViewModel model)
{
var vm = await _account.BuildLoggedOutViewModelAsync(model.LogoutId);
if (vm.TriggerExternalSignout)
{
string url = Url.Action("Logout", new { logoutId = vm.LogoutId });
try
{
// hack: try/catch to handle social providers that throw
await HttpContext.Authentication.SignOutAsync(vm.ExternalAuthenticationScheme,
new AuthenticationProperties { RedirectUri = url });
}
catch (NotSupportedException) // this is for the external providers that don't have signout
{
}
catch (InvalidOperationException) // this is for Windows/Negotiate
{
}
}
// delete authentication cookie
await _signInManager.SignOutAsync();
return View("LoggedOut", vm);
}
誰かが実際にクライアント上で必要とされるもののロジックを説明することができます。
https://github.com/IdentityServer/IdentityServer4.Demo/blob/master/src/IdentityServer4Demo/Quickstart/Account/AccountController.cs –