public async Task <ActionResult> SingleLogoutService()
        {
            // Receive the single logout request or response.
            // If a request is received then single logout is being initiated by a partner service provider.
            // If a response is received then this is in response to single logout having been initiated by the identity provider.
            var sloResult = await _samlIdentityProvider.ReceiveSloAsync();

            if (sloResult.IsResponse)
            {
                if (sloResult.HasCompleted)
                {
                    // IdP-initiated SLO has completed.
                    return(RedirectToPage("/Index"));
                }
            }
            else
            {
                // Logout locally.
                await _signInManager.SignOutAsync();

                // Respond to the SP-initiated SLO request indicating successful logout.
                await _samlIdentityProvider.SendSloAsync();
            }

            return(new EmptyResult());
        }
示例#2
0
        public async Task <IActionResult> SingleLogoutService()
        {
            // receive response from SP
            var sloResult = await _samlIdentityProvider.ReceiveSloAsync();

            if (sloResult.IsResponse)
            {
                // idp-initiated SLO
                if (sloResult.HasCompleted)
                {
                    await _signInManager.SignOutAsync();

                    if (!string.IsNullOrEmpty(sloResult.RelayState))
                    {
                        return(LocalRedirect(sloResult.RelayState));
                    }
                    return(RedirectToPage("/Index"));
                }
            }
            else
            {
                // sp-initiated SLO
                await _signInManager.SignOutAsync();

                // send response back to SP
                await _samlIdentityProvider.SendSloAsync();
            }
            return(new EmptyResult());
        }