public async Task <IActionResult> SingleLogoutService() { // Receive the single logout request or response. // If a request is received then single logout is being initiated by the identity provider. // If a response is received then this is in response to single logout having been initiated by the service provider. var sloResult = await _samlServiceProvider.ReceiveSloAsync(); if (sloResult.IsResponse) { // SP-initiated SLO has completed. if (!string.IsNullOrEmpty(sloResult.RelayState)) { return(LocalRedirect(sloResult.RelayState)); } return(RedirectToAction("Login", "Account")); } else { // Logout locally. await _signInManager.SignOutAsync(); // Respond to the IdP-initiated SLO request indicating successful logout. await _samlServiceProvider.SendSloAsync(); } return(new EmptyResult()); }
public async Task <IActionResult> SingleLogoutService() { // SP receive logout request from IdP var sloResult = await _samlServiceProvider.ReceiveSloAsync(); if (sloResult.IsResponse) { // SP-initated SLO //if (sloResult.HasCompleted) //{ await _signInManager.SignOutAsync(); if (!string.IsNullOrEmpty(sloResult.RelayState)) { return(LocalRedirect(sloResult.RelayState)); } return(RedirectToPage("/Index")); //} } else { // idp-initiated SLO await _signInManager.SignOutAsync(); // send back response to IdP's SLO service await _samlServiceProvider.SendSloAsync(); } return(new EmptyResult()); }