lasso_saml20_login_process_paos_response_msg(LassoLogin *login, gchar *msg)
{
	LassoSoapHeader *header = NULL;
	LassoProfile *profile;
	int rc;

	lasso_null_param(msg);

	profile = LASSO_PROFILE(login);

        /*
         * lasso_saml20_profile_process_soap_response_with_headers()
         * performs a signature check on the SAML message. A signature
         * can also appear on the assertion which is checked by
         * lasso_saml20_login_process_response_status_and_assertion()
         * (below). Therefore if the error is SIGNATURE_NOT_FOUND we
         * proceed because
         * lasso_saml20_login_process_response_status_and_assertion()
         * will test the signature on the assertion.
         */
	rc = lasso_saml20_profile_process_soap_response_with_headers(profile, msg, &header);
        if (rc != 0 && rc != LASSO_DS_ERROR_SIGNATURE_NOT_FOUND) {
            return rc;
        }

	/*
	 * If the SOAP message contained a header check for the optional
	 * paos:Response and ecp:RelayState elements, if they exist extract their
	 * values into the profile.
	 */
	if (header) {
		GList *i = NULL;
		LassoEcpRelayState *ecp_relaystate = NULL;
		LassoPaosResponse *paos_response = NULL;

		lasso_foreach(i, header->Other) {
			if (!ecp_relaystate && LASSO_IS_ECP_RELAYSTATE(i->data)) {
				ecp_relaystate = (LassoEcpRelayState *)i->data;
			} else if (!paos_response && LASSO_IS_PAOS_RESPONSE(i->data)) {
				paos_response = (LassoPaosResponse *)i->data;
			}
			if (ecp_relaystate && paos_response) break;
		}
		if (ecp_relaystate) {
			lasso_assign_string(profile->msg_relayState, ecp_relaystate->RelayState);
		}
		if (paos_response) {
			lasso_profile_set_message_id(profile, paos_response->refToMessageID);
		}
		lasso_release_gobject(header);
	}

	rc = lasso_saml20_login_process_response_status_and_assertion(login);
	return rc;
}
lasso_saml20_login_process_paos_response_msg(LassoLogin *login, gchar *msg)
{
	LassoSoapHeader *header = NULL;
	LassoProfile *profile;
	int rc;

	lasso_null_param(msg);

	profile = LASSO_PROFILE(login);

         
	rc = lasso_saml20_profile_process_soap_response_with_headers(profile, msg, &header);
        if (rc != 0 && rc != LASSO_DS_ERROR_SIGNATURE_NOT_FOUND) {
            return rc;
        }

	 
	if (header) {
		GList *i = NULL;
		LassoEcpRelayState *ecp_relaystate = NULL;
		LassoPaosResponse *paos_response = NULL;

		lasso_foreach(i, header->Other) {
			if (!ecp_relaystate && LASSO_IS_ECP_RELAYSTATE(i->data)) {
				ecp_relaystate = (LassoEcpRelayState *)i->data;
			} else if (!paos_response && LASSO_IS_PAOS_RESPONSE(i->data)) {
				paos_response = (LassoPaosResponse *)i->data;
			}
			if (ecp_relaystate && paos_response) break;
		}
		if (ecp_relaystate) {
			lasso_assign_string(profile->msg_relayState, ecp_relaystate->RelayState);
		}
		if (paos_response) {
			lasso_profile_set_message_id(profile, paos_response->refToMessageID);
		}
		lasso_release_gobject(header);
	}

	rc = lasso_saml20_login_process_response_status_and_assertion(login);
	return rc;
}