public async Task <IActionResult> Logout(LogoutInputModel model) { // build a model so the logged out page knows what to display 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())); } return(View("LoggedOut", vm)); }
public async Task <IActionResult> Logout(LogoutInputModel model) { /*var vm = await BuildLoggedOutViewModelAsync(model.LogoutId);*/ if (User?.Identity.IsAuthenticated == true) { // Delete local authentication cookie. await HttpContext.SignOutAsync(); // uncomment this when services.AddAuthentication() options are uncommented // await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); // await HttpContext.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme); await events.RaiseAsync(new UserLogoutSuccessEvent(User.GetSubjectId(), User.GetDisplayName())); // Set this so UI rendering sees an anonymous user. HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); } return(Redirect("~/")); /*return View("LoggedOut", vm); // "LoggedOut", vm);*/ }