def federationTermination(self, context):
        request = context.REQUEST
        session = request.SESSION

        sessionDump = session.get('sessionDump')
        nameIdentifier = session.get('nameIdentifier')
        identityDump = self.federations.getIdentityDump(nameIdentifier)

        query_string = request.get('QUERY_STRING') or ''
        if lasso.isLibertyQuery(query_string):
            next_url, body = self.processFederationTerminationNotificationMsg(
                fedTermRequest, sessionDump, identityDump)
            if sessionDump:
                del session['sessionDump']
            if nameIdentifier:
                del session['nameIdentifier']
            context.acl_users.logout(request)
            return next_url
        else:
            lassoServer = self.getLassoServer()
            fedTerm = lasso.Defederation(lassoServer)
            fedTerm.setSessionFromDump(sessionDump)
            fedTerm.setIdentityFromDump(identityDump)
            fedTerm.initNotification(lassoServer.providerIds[0], lasso.HTTP_METHOD_SOAP)
            fedTerm.buildNotificationMsg()
            soapResponseMessage = self.soap_call(fedTerm.msgUrl, fedTerm.msgBody)
            if not soapResponseMessage:
                return self.error_page('No SOAP response from identity provider')
            self.federations.removeFederation(nameIdentifier)
            del session['nameIdentifier']
            del session['sessionDump']
            return self.config['root_url']
    def singleLogoutSOAP(self, context):
        request = context.REQUEST
        response = request.RESPONSE
        session = request.SESSION

        sessionDump = session.get('sessionDump')
        nameIdentifier = session.get('nameIdentifier')
        identityDump = self.federations.getIdentityDump(nameIdentifier)

        query_string = request.get('QUERY_STRING') or ''
        if lasso.isLibertyQuery(query_string):
            next_url, body = self.processLogoutRequestMsg(query_string, sessionDump, identityDump)
            if sessionDump:
                del session['sessionDump']
            if nameIdentifier:
                del session['nameIdentifier']
            context.acl_users.logout(request)
            return next_url
        else:
            logout = lasso.Logout(self.getLassoServer())
            logout.setSessionFromDump(sessionDump)
            logout.setIdentityFromDump(identityDump)
            logout.initRequest(None, lasso.HTTP_METHOD_SOAP)
            logout.buildRequestMsg()
            soapResponseMessage = self.soap_call(logout.msgUrl, logout.msgBody)
            if not soapResponseMessage:
                return self.error_page('No SOAP response from identity provider')
            logout.processResponseMsg(soapResponseMessage)
            del session['sessionDump']
            del session['nameIdentifier']
            context.acl_users.logout(request)
            return self.config['root_url']
    def singleLogout(self, context):
        request = context.REQUEST
        response = request.RESPONSE
        session = request.SESSION

        sessionDump = session.get('sessionDump')
        nameIdentifier = session.get('nameIdentifier')
        identityDump = self.federations.getIdentityDump(nameIdentifier)

        query_string = request.get('QUERY_STRING') or ''
        if lasso.isLibertyQuery(query_string):
            next_url, body = self.processLogoutRequestMsg(query_string, sessionDump, identityDump)
            if sessionDump:
                del session['sessionDump']
            if nameIdentifier:
                del session['nameIdentifier']
            context.acl_users.logout(request)
            return next_url
        else:
            logout = lasso.Logout(self.getLassoServer())
            if sessionDump:
                logout.setSessionFromDump(sessionDump)
            if identityDump:
                logout.setIdentityFromDump(identityDump)
            # FIXME: Check Lasso exceptions
            logout.initRequest(None, lasso.HTTP_METHOD_REDIRECT)
            logout.buildRequestMsg()
            return logout.msgUrl