0

I'm using ComponentSpace for SSO which is working fine, but it gives error when I try to SendSLO from the SP, where SLO is initiated by the ADFS server (IdP).

The code:

        bool isRequest = false;
        string logoutReason = null;
        string partnerSP = null;

        try
        {
            ComponentSpace.SAML2.SAMLServiceProvider.ReceiveSLO(Request, out isRequest, out logoutReason, out partnerSP);
        }
        catch (SAMLProtocolException ex)
        {
            if (ex.Message != "A logout response was unexpectedly received.") //Multiple SLOs can be sent on each logout
                CommonRepository.LogException(ex.Message, ex, "SAML logout error");
        }
        catch (Exception ex)
        {
            CommonRepository.LogException(ex.Message, ex, "SAML logout error");
        }
        if (isRequest) {
            // Logout locally.
            FormsAuthentication.SignOut();

            // Respond to the IdP-initiated SLO request indicating successful logout.
            ComponentSpace.SAML2.SAMLServiceProvider.SendSLO(Response, null);  // Fails at this point
        } else {
            // SP-initiated SLO has completed.
            //FormsAuthentication.RedirectToLoginPage();

            // This will log out the user from Communifire Application
            Utilities.LogoutWithoutRedirect();

            .....

        }

enter image description here

When IdP initiates SLO, first I call ReceiveSLO, then logout from the service provider, at last call SendSLO, but it throws ComponentSpace.SAML2.Exceptions.SAMLProtocolException: 'There is no pending identity provider logout request.'

How can I fix this? If I call IsSendSLOPending, it returns false, why is that?

Thank you.

4

0 回答 0