Hello, I have an ASP .NET Core application that performs SP functionality where I need to present an error page to the user when error occurs and perform SLO. I've tried something like this on the error page:
Snippetvar ssoState = await this.samlServiceProvider.GetStatusAsync(); if (await ssoState.CanSloAsync()) { await this.samlServiceProvider.InitiateSloAsync("IdP", "Error"); } Snippetreturn new EmptyResult();
My SAML controller logout route looks like this:
[Route("LogOut")] public async Task<IActionResult> SingleLogoutService() { var sloResult = await this.samlServiceProvider.ReceiveSloAsync(); if (sloResult.IsResponse) { if (!string.IsNullOrEmpty(sloResult.RelayState)) { return LocalRedirect(sloResult.RelayState); } return RedirectToPage("/Login"); } await this.HttpContext.SignOutAsync(); await this.samlServiceProvider.SendSloAsync(); return new EmptyResult(); }
The above code for "LogOut" route handles the logout request, but there doesn't appear to be a way to determine if this a standard logout request or logout request due to an error page request. I thought I could set reason to something like "Error" when initiating SP logout, but I get empty reason when IdP redirects back to SP.
Is there a way to accomplish what I'm trying to do here?
Thank you in advance.Snippet
|