public async Task <IActionResult> Logout(LogoutInput input) { // build a model so the logged out page knows what to display //var vm = await BuildLoggedOutViewModelAsync(input.LogoutId); if (User?.Identity.IsAuthenticated == true) { // delete local authentication cookie await HttpContext.SignOutAsync(); await HttpContext.SignOutAsync(IdentityServerConstants.DefaultCookieAuthenticationScheme); // raise the logout event await _events.RaiseAsync(new UserLogoutSuccessEvent(User.GetSubjectId(), User.GetDisplayName())); } // check if we need to trigger sign-out at an upstream identity provider //if (vm.TriggerExternalSignout) //{ // // 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. // string url = Url.Action("Logout", new { logoutId = vm.LogoutId }); // // this triggers a redirect to the external provider for sign-out // return SignOut(new AuthenticationProperties { RedirectUri = url }, vm.ExternalAuthenticationScheme); //} return(new JsonResult(new ReponseModel { Data = "" })); }
public async Task Logout_StateUnderTest_ExpectedBehavior() { // Arrange var service = this.CreateService(); LogoutInput input = null; // Act await service.Logout( input); // Assert Assert.True(false); }
/// <summary> /// Kullanıcıyı logout eder. Çalışabilmesi için "x-gm-token" header içinde gelmelidir. /// </summary> /// <param name="info"></param> /// <returns></returns> public static LogoutOutput Logout(LogoutInput info) { var t = HttpContext.Current.Request.Headers["x-gm-token"]; if (t == null) { return(new LogoutOutput()); } _userCache.Remove(t); return(new LogoutOutput()); }
public async Task <IActionResult> Logout([FromBody] LogoutInput logoutInput) { await _signInManager.SignOutAsync(); var returnUrl = logoutInput.ReturnUrl; _logger.LogInformation("User logged out."); if (!string.IsNullOrWhiteSpace(returnUrl)) { return(Ok(new RedirectResponse() { Pathname = returnUrl })); } else { return(Ok(new RedirectResponse() { Pathname = "" })); } }
public LogoutOutput LogOut(LogoutInput parameters) { return(SessionManagement.Logout(parameters)); }