diff options
| author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2009-03-27 15:05:04 +0000 |
|---|---|---|
| committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2009-03-27 15:05:04 +0000 |
| commit | dfb0b91ed6d3c85aa7764de75d2e5298ed93ba22 (patch) | |
| tree | fb56882f950d9f35316a0d485b908ebd2093ece7 | |
| parent | 141c4a382ea5a893f09ce3675554c1ca166f2843 (diff) | |
| download | lasso-dfb0b91ed6d3c85aa7764de75d2e5298ed93ba22.tar.gz lasso-dfb0b91ed6d3c85aa7764de75d2e5298ed93ba22.tar.xz lasso-dfb0b91ed6d3c85aa7764de75d2e5298ed93ba22.zip | |
ID-WSF 2.0: make it work with --enabe-debugging
* lasso/id-wsf-2.0/data_service.c:
* lasso/id-wsf-2.0/discovery.c:
* lasso/id-wsf-2.0/profile.c:
* lasso/id-wsf/data_service.c:
* lasso/id-wsf/discovery.c:
* lasso/id-wsf/wsf_profile.c:
when --enable-debugging is activated much more type checking is done
by internal macros, and code do not pass compile anymore.
* bindings/python/tests/idwsf2_tests.py: nameIdentifier packing in SOAP
ID-WSF calls headers is no longer supported, do not test it.
| -rwxr-xr-x | bindings/python/tests/idwsf2_tests.py | 6 | ||||
| -rw-r--r-- | lasso/id-wsf-2.0/data_service.c | 8 | ||||
| -rw-r--r-- | lasso/id-wsf-2.0/discovery.c | 7 | ||||
| -rw-r--r-- | lasso/id-wsf-2.0/profile.c | 82 | ||||
| -rw-r--r-- | lasso/id-wsf/data_service.c | 4 | ||||
| -rw-r--r-- | lasso/id-wsf/discovery.c | 18 | ||||
| -rw-r--r-- | lasso/id-wsf/wsf_profile.c | 2 |
7 files changed, 38 insertions, 89 deletions
diff --git a/bindings/python/tests/idwsf2_tests.py b/bindings/python/tests/idwsf2_tests.py index 7500ab25..bbc66c5d 100755 --- a/bindings/python/tests/idwsf2_tests.py +++ b/bindings/python/tests/idwsf2_tests.py @@ -901,9 +901,6 @@ class DiscoveryQueryTestCase(IdWsf2TestCase): idp_disco.processQueryMsg(wsc_disco.msgBody) - self.failUnless(idp_disco.nameIdentifier and idp_disco.nameIdentifier.content, - 'missing name identifier') - def test08(self): """Build discovery query response EPRs""" idp = self.getIdpServer() @@ -1322,9 +1319,6 @@ class DataServiceQueryTestCase(IdWsf2TestCase): wsp_service = lasso.IdWsf2DataService(wsp) wsp_service.processQueryMsg(service.msgBody) - self.failUnless(wsp_service.nameIdentifier and wsp_service.nameIdentifier.content, - 'missing name identifier') - def test11(self): """Data service parse query items - success""" service, wsp = self.getProfileService() diff --git a/lasso/id-wsf-2.0/data_service.c b/lasso/id-wsf-2.0/data_service.c index 033d51f3..2cdaf4bc 100644 --- a/lasso/id-wsf-2.0/data_service.c +++ b/lasso/id-wsf-2.0/data_service.c @@ -93,7 +93,7 @@ lasso_idwsf2_data_service_init_query(LassoIdWsf2DataService *service) if (LASSO_PROFILE(profile)->request) { lasso_node_destroy(LASSO_NODE(LASSO_PROFILE(profile)->request)); } - lasso_assign_new_gobject(LASSO_PROFILE(profile)->request, query); + lasso_assign_new_gobject(LASSO_PROFILE(profile)->request, LASSO_NODE(query)); if (service == NULL || service->private_data == NULL || service->private_data->epr == NULL @@ -268,7 +268,7 @@ lasso_idwsf2_data_service_parse_query_items(LassoIdWsf2DataService *service) response = lasso_idwsf2_dstref_query_response_new(); response->prefixServiceType = g_strdup(request->prefixServiceType); response->hrefServiceType = g_strdup(request->hrefServiceType); - lasso_assign_new_gobject(LASSO_PROFILE(profile)->response, response); + lasso_assign_new_gobject(LASSO_PROFILE(profile)->response, LASSO_NODE(response)); lasso_list_add_gobject(envelope->Body->any, response); /* Initialise XML parsing */ @@ -673,7 +673,7 @@ lasso_idwsf2_data_service_init_modify(LassoIdWsf2DataService *service) LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); modify = lasso_idwsf2_dstref_modify_new(); - lasso_assign_new_gobject(LASSO_PROFILE(profile)->request, modify); + lasso_assign_new_gobject(LASSO_PROFILE(profile)->request, LASSO_NODE(modify)); if (service == NULL || service->private_data == NULL || service->private_data->epr == NULL @@ -906,7 +906,7 @@ lasso_idwsf2_data_service_parse_modify_items(LassoIdWsf2DataService *service) response = lasso_idwsf2_dstref_modify_response_new(); response->prefixServiceType = g_strdup(request->prefixServiceType); response->hrefServiceType = g_strdup(request->hrefServiceType); - lasso_assign_new_gobject(LASSO_PROFILE(profile)->response, response); + lasso_assign_new_gobject(LASSO_PROFILE(profile)->response, LASSO_NODE(response)); lasso_list_add_gobject(envelope->Body->any, response); response2 = LASSO_IDWSF2_UTIL_RESPONSE(response); diff --git a/lasso/id-wsf-2.0/discovery.c b/lasso/id-wsf-2.0/discovery.c index 0e2d8efc..b72ac40a 100644 --- a/lasso/id-wsf-2.0/discovery.c +++ b/lasso/id-wsf-2.0/discovery.c @@ -228,7 +228,8 @@ lasso_idwsf2_discovery_process_metadata_register_msg(LassoIdWsf2Discovery *disco request = LASSO_IDWSF2_DISCO_SVC_MD_REGISTER(LASSO_PROFILE(profile)->request); /* FIXME : foreach on the list instead */ if (request != NULL && request->SvcMD != NULL) { - lasso_assign_gobject(discovery->metadata, request->SvcMD->data); + lasso_assign_gobject(discovery->metadata, + LASSO_IDWSF2_DISCO_SVC_METADATA(request->SvcMD->data)); /* Build a unique SvcMDID */ lasso_build_random_sequence(unique_id, 32); unique_id[32] = 0; @@ -383,7 +384,7 @@ lasso_idwsf2_discovery_process_metadata_association_add_msg(LassoIdWsf2Discovery envelope = profile->soap_envelope_response; envelope->Body->any = g_list_append(envelope->Body->any, response); - lasso_assign_gobject(LASSO_PROFILE(profile)->response, response); + lasso_assign_gobject(LASSO_PROFILE(profile)->response, LASSO_NODE(response)); return res; } @@ -512,7 +513,7 @@ lasso_idwsf2_discovery_init_query(LassoIdWsf2Discovery *discovery, G_GNUC_UNUSED g_return_val_if_fail(LASSO_IS_SESSION(session), LASSO_PROFILE_ERROR_SESSION_NOT_FOUND); - lasso_assign_new_gobject(LASSO_PROFILE(profile)->request, lasso_idwsf2_disco_query_new()); + lasso_assign_new_gobject(LASSO_PROFILE(profile)->request, (LassoNode*)lasso_idwsf2_disco_query_new()); lasso_idwsf2_profile_init_soap_request(profile, LASSO_PROFILE(profile)->request, LASSO_IDWSF2_DISCO_HREF); diff --git a/lasso/id-wsf-2.0/profile.c b/lasso/id-wsf-2.0/profile.c index 2ce7f276..cfac5d42 100644 --- a/lasso/id-wsf-2.0/profile.c +++ b/lasso/id-wsf-2.0/profile.c @@ -104,7 +104,7 @@ lasso_idwsf2_profile_init_soap_request(LassoIdWsf2Profile *profile, LassoNode *r if (assertion != NULL) { wsse_security = lasso_wsse_security_header_new(); - lasso_list_add(wsse_security->any, assertion); + lasso_list_add_new_gobject(wsse_security->any, assertion); envelope->Header->Other = g_list_append(envelope->Header->Other, wsse_security); } @@ -128,81 +128,35 @@ lasso_idwsf2_profile_build_request_msg(LassoIdWsf2Profile *profile) } gint -lasso_idwsf2_profile_process_soap_request_msg(LassoIdWsf2Profile *profile, const gchar *message) +lasso_idwsf2_profile_process_soap_request_msg(LassoIdWsf2Profile *wsf2_profile, const gchar *message) { + LassoProfile *profile = NULL; LassoSoapEnvelope *envelope = NULL; - LassoSaml2Assertion *assertion = NULL; - LassoWsSec1SecurityHeader *wsse_security; - LassoSaml2EncryptedElement *encrypted_id = NULL; - LassoNode *decrypted_name_id = NULL; - xmlSecKey *encryption_private_key = NULL; - GList *i; - GList *j; - int res = 0; + int rc = 0; - g_return_val_if_fail(LASSO_IS_IDWSF2_PROFILE(profile), + g_return_val_if_fail(LASSO_IS_IDWSF2_PROFILE(wsf2_profile), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); g_return_val_if_fail(message != NULL, LASSO_PARAM_ERROR_INVALID_VALUE); /* Get soap request */ - lasso_assign_new_gobject(profile->soap_envelope_request, lasso_soap_envelope_new_from_message(message)); - envelope = profile->soap_envelope_request; - - lasso_release_gobject(LASSO_PROFILE(profile)->nameIdentifier); - - /* Get NameIdentifier (if exists) from the soap header */ - for (i = g_list_first(envelope->Header->Other); i != NULL; i = g_list_next(i)) { - if (! LASSO_IS_WSSE_SECURITY_HEADER(i->data)) { - continue; - } - wsse_security = LASSO_WSSE_SECURITY_HEADER(i->data); - for (j = g_list_first(wsse_security->any); j != NULL; j = g_list_next(j)) { - if (! LASSO_IS_SAML2_ASSERTION(j->data)) { - continue; - } - assertion = LASSO_SAML2_ASSERTION(j->data); - if (assertion->Subject == NULL) { - continue; - } - if (LASSO_IS_SAML2_NAME_ID(assertion->Subject->NameID)) { - lasso_assign_gobject(LASSO_PROFILE(profile)->nameIdentifier, - assertion->Subject->NameID); - } else if (LASSO_IS_SAML2_ENCRYPTED_ELEMENT( - assertion->Subject->EncryptedID)) { - encrypted_id = assertion->Subject->EncryptedID; - } else { - continue; - } - break; - } - break; + profile = LASSO_PROFILE(wsf2_profile); + lasso_assign_new_gobject(wsf2_profile->soap_envelope_request, lasso_soap_envelope_new_from_message(message)); + if (! LASSO_IS_SOAP_ENVELOPE(wsf2_profile->soap_envelope_request)) { + return LASSO_PROFILE_ERROR_INVALID_MSG; } - - /* Decrypt NameID */ - encryption_private_key = LASSO_PROFILE( - profile)->server->private_data->encryption_private_key; - if (LASSO_PROFILE(profile)->nameIdentifier == NULL && encrypted_id != NULL - && encryption_private_key != NULL) { - decrypted_name_id = lasso_node_decrypt(encrypted_id, encryption_private_key); - lasso_assign_new_gobject(LASSO_PROFILE(profile)->nameIdentifier, decrypted_name_id); - lasso_release_gobject(assertion->Subject->EncryptedID); - } - - if (envelope != NULL && envelope->Body != NULL && envelope->Body->any != NULL) { - lasso_assign_gobject(LASSO_PROFILE(profile)->request, envelope->Body->any->data); + envelope = wsf2_profile->soap_envelope_request; + if (envelope != NULL && envelope->Body != NULL && envelope->Body->any != NULL && + LASSO_IS_NODE(envelope->Body->any->data)) { + lasso_assign_gobject(LASSO_PROFILE(profile)->request, (LassoNode*)envelope->Body->any->data); } else { - res = LASSO_SOAP_ERROR_MISSING_BODY; + rc = LASSO_SOAP_ERROR_MISSING_BODY; } - if (LASSO_PROFILE(profile)->request == NULL) { - res = LASSO_PROFILE_ERROR_MISSING_REQUEST; - } + /* Initialize soap response */ + lasso_assign_new_gobject(wsf2_profile->soap_envelope_response, lasso_idwsf2_profile_build_soap_envelope(NULL, + LASSO_PROVIDER(profile->server)->ProviderID)); - /* Set soap response */ - lasso_assign_new_gobject(profile->soap_envelope_response, lasso_idwsf2_profile_build_soap_envelope(NULL, - LASSO_PROVIDER(LASSO_PROFILE(profile)->server)->ProviderID)); - - return res; + return rc; } gint diff --git a/lasso/id-wsf/data_service.c b/lasso/id-wsf/data_service.c index 065881a2..47cc1122 100644 --- a/lasso/id-wsf/data_service.c +++ b/lasso/id-wsf/data_service.c @@ -772,13 +772,13 @@ lasso_data_service_build_modify_response_msg(LassoDataService *service) /* If we must replace the root element, change it in the xmlDoc */ if (node == cur_data) { xmlDocSetRootElement(doc, xmlCopyNode(newNode,1)); - lasso_list_add(node_to_free, node); + lasso_list_add_xml_node(node_to_free, node); cur_data = NULL; } else { xmlReplaceNode(node, xmlCopyNode(newNode,1)); /* Node is a free node now but is still reference by the xpath nodeset we must wait for the deallocation of the nodeset to free it. */ - lasso_list_add(node_to_free, node); + lasso_list_add_xml_node(node_to_free, node); } } } else { diff --git a/lasso/id-wsf/discovery.c b/lasso/id-wsf/discovery.c index 63d55dce..20a7208d 100644 --- a/lasso/id-wsf/discovery.c +++ b/lasso/id-wsf/discovery.c @@ -168,7 +168,7 @@ lasso_discovery_build_credential(LassoDiscovery *discovery, G_GNUC_UNUSED const /* SubjectConfirmation */ subject_confirmation = lasso_saml_subject_confirmation_new(); - lasso_list_add(subject_confirmation->ConfirmationMethod, + lasso_list_add_string(subject_confirmation->ConfirmationMethod, g_strdup(LASSO_SAML_CONFIRMATION_METHOD_HOLDER_OF_KEY)); /* Add public key value in credential */ @@ -185,7 +185,7 @@ lasso_discovery_build_credential(LassoDiscovery *discovery, G_GNUC_UNUSED const /* Add credential to disco:QueryResponse */ response = LASSO_DISCO_QUERY_RESPONSE(profile->response); credentials = lasso_disco_credentials_new(); - lasso_list_add(credentials->any, assertion); + lasso_list_add_new_gobject(credentials->any, assertion); response->Credentials = credentials; return g_strdup(assertion->AssertionID); @@ -225,7 +225,7 @@ lasso_discovery_add_insert_entry(LassoDiscovery *discovery, insertEntry = lasso_disco_insert_entry_new(resourceOffering); - lasso_list_add(modify->InsertEntry, insertEntry); + lasso_list_add_new_gobject(modify->InsertEntry, insertEntry); return insertEntry; } @@ -253,7 +253,7 @@ lasso_discovery_add_remove_entry(LassoDiscovery *discovery, modify = LASSO_DISCO_MODIFY(LASSO_WSF_PROFILE(discovery)->request); /* add RemoveEntry */ - lasso_list_add(modify->RemoveEntry, lasso_disco_remove_entry_new(entryID)); + lasso_list_add_new_gobject(modify->RemoveEntry, lasso_disco_remove_entry_new(entryID)); return 0; } @@ -301,7 +301,7 @@ lasso_discovery_add_requested_service_type(LassoDiscovery *discovery, } /* add RequestedServiceType */ - lasso_list_add(query->RequestedServiceType, rst); + lasso_list_add_new_gobject(query->RequestedServiceType, rst); return rst; } @@ -513,7 +513,7 @@ lasso_discovery_init_insert(LassoDiscovery *discovery, LassoDiscoResourceOfferin lasso_wsf_profile_set_description(profile, description); assign_resource_id(offering, modify); lasso_node_destroy(LASSO_NODE(offering)); - lasso_list_add(modify->InsertEntry, lasso_disco_insert_entry_new(new_offering)); + lasso_list_add_new_gobject(modify->InsertEntry, lasso_disco_insert_entry_new(new_offering)); if (description->Endpoint != NULL) { profile->msg_url = g_strdup(description->Endpoint); } /* TODO: else, description->WsdlURI, get endpoint automatically */ @@ -562,7 +562,7 @@ lasso_discovery_init_remove(LassoDiscovery *discovery, const char *entry_id) /* TODO: EncryptedResourceID support */ modify->ResourceID = g_object_ref(offering->ResourceID); lasso_node_destroy(LASSO_NODE(offering)); - lasso_list_add(modify->RemoveEntry, lasso_disco_remove_entry_new(entry_id)); + lasso_list_add_new_gobject(modify->RemoveEntry, lasso_disco_remove_entry_new(entry_id)); if (description->Endpoint != NULL) { profile->msg_url = g_strdup(description->Endpoint); } /* TODO: else, description->WsdlURI, get endpoint automatically */ @@ -883,7 +883,7 @@ lasso_discovery_build_response_msg(LassoDiscovery *discovery) iter3->data) == TRUE) { credentialRef = lasso_discovery_build_credential( discovery, NULL); - lasso_list_add(description->CredentialRef, credentialRef); + lasso_list_add_new_gobject(description->CredentialRef, credentialRef); } iter3 = g_list_next(iter3); } @@ -1051,7 +1051,7 @@ lasso_discovery_get_services(LassoDiscovery *discovery) continue; } service = lasso_discovery_build_wsf_profile(discovery, offering); - lasso_list_add(services, service); + lasso_list_add_new_gobject(services, service); } return services; diff --git a/lasso/id-wsf/wsf_profile.c b/lasso/id-wsf/wsf_profile.c index f5936d11..c67873ab 100644 --- a/lasso/id-wsf/wsf_profile.c +++ b/lasso/id-wsf/wsf_profile.c @@ -125,7 +125,7 @@ lasso_wsf_profile_comply_with_saml_authentication(LassoWsfProfile *profile) char *ref = (char*)credentialRefs->data; xmlNode *assertion = lasso_session_get_assertion_by_id(session, ref); if (assertion) { - lasso_list_add(wsse_security->any, assertion); + lasso_list_add_xml_node(wsse_security->any, assertion); } credentialRefs = g_list_next(credentialRefs); } |
