Commit Graph

4114 Commits

Author SHA1 Message Date
Benjamin Dauvergne 70299b52ab Test: add missing release of objects and memory
* tests/basic_tests.c:
 * tests/login_tests.c:
 * tests/metadata_tests.c:
 * tests/random_tests.c:
 * tests/tests.c:
   add missing g_free and g_object_unref calls.
2009-03-27 15:06:25 +00:00
Benjamin Dauvergne 84e5c3b66b Bindings: skip DEPRECATED variables
* bindings/bindings.py: when parsing headers, skipped deprecated struct
   fields.
2009-03-27 15:06:24 +00:00
Benjamin Dauvergne c89c77c924 ID-FF 1.2: Add handling of relaystate for logout requests
* lasso/id-ff/logout.c (lasso_logout_process_request_msg,
 lasso_logout_validate_request): transfer relaystate from request
 message to profile field.
2009-03-27 15:06:23 +00:00
Benjamin Dauvergne 854df3b651 ID-FF 1.2: Use new macros in logout, defederation and lecp
* lasso/id-ff/logout.c:
 - (lasso_logout_build_response_msg, lasso_logout_init_request,
    lasso_logout_process_request_msg, lasso_logout_process_response_msg,
    lasso_logout_validate_request) use lasso_assign_new_object,
   lasso_assign_string, lasso_release and lasso_assign_new_string when
   possible.
 - (lasso_logout_process_response_msg) move the tranfer of the relaystate
   from XML object to profile object.

* lasso/id-ff/defederation.c:
 - (lasso_defederation_build_notification_msg,
    lasso_defederation_init_notification,
    lasso_defederation_process_notification_msg,
    lasso_defederation_validate_notification): idem

* lasso/id-ff/lecp.c:
 - (lasso_lecp_build_authn_request_envelope_msg,
    lasso_lecp_build_authn_request_msg,lasso_lecp_build_authn_response_msg,
    lasso_lecp_build_authn_response_envelope_msg) idem
2009-03-27 15:06:21 +00:00
Benjamin Dauvergne 62de952ae9 Autoconf: Do not include optimisation flags in AM_CFLAGS
* configure.ac: when --enable-debugging set CFLAGS,
  do not modify AM_CFLAGS.
2009-03-27 15:06:19 +00:00
Benjamin Dauvergne d85f440885 ID-FF 1.2 Tests: Add test for relaystate
* tests/login_tests.c:
 - (test02_serviceProviderLogin) add assertion concerning the relaying
   of the RelayState parameter during an SP initiated SSO.
2009-03-27 15:06:18 +00:00
Benjamin Dauvergne 5268ee2928 ID-FF 1.2 Login: Use allocation macros
* lasso/id-ff/login.c: (lasso_login_init_authn_request) again a passing by
  correction, use lasso_assign_string for copying information from
  the request to the profile object.
2009-03-27 15:06:17 +00:00
Benjamin Dauvergne fbc86db17f ID-FF 1.2: Handle RelayState inside LassoLogin
* lasso/id-ff/login.c:
   - (lasso_login_init_request) catch RelayState in the query_fields and
     copy it to msg_relayState
   - (lasso_login_process_authn_request_msg) copy RelayState from the
     request object to the profile object.
2009-03-27 15:06:15 +00:00
Benjamin Dauvergne 93dc7ca545 XML ID-FF 1.2 & SAML 2.0: Handle signature failure
* lasso/xml/saml_assertion.c:
 * lasso/xml/samlp_response_abstract.c:
 * lasso/xml/samlp_request_abstract.c:
 * lasso/xml/saml-2.0/samlp2_request_abstract.c:
 * lasso/xml/saml-2.0/saml2_assertion.c:
 * lasso/xml/saml-2.0/samlp2_status_response.c:
   if a failure occur in the signing process, free the xmlnode, return
   NULL and print a warning.
2009-03-27 15:06:13 +00:00
Benjamin Dauvergne 4b8f9075ef XML SAML 2.0: Delete parent_class static variable
* lasso/xml/saml-2.0/samlp2_manage_name_id_request.c,
  lasso/xml/saml-2.0/samlp2_manage_name_id_response.c,
  lasso/xml/saml-2.0/samlp2_name_id_mapping_request.c,
  lasso/xml/saml-2.0/samlp2_name_id_mapping_response.c.
  lasso/xml/saml-2.0/samlp2_subject_query_abstract.c:
  - remove static variable parent_class
  - (class_init) remove intialization of parent_class
2009-03-27 15:06:12 +00:00
Benjamin Dauvergne 91d9d67812 XML SAML 2.0: Mark RelayState field from SAML 2.0 deprecated
* lasso/xml/saml-2.0/samlp2_authn_request.c,
   lasso/xml/saml-2.0/samlp2_logout_request.c,
   - (instance_init) remove initialization of relayState field

 * lasso/xml/saml-2.0/samlp2_logout_response.c:
   - (instance_init) remove empty function, since it
     only initialized relayState.
   - (lasso_samlp2_logout_reponse_get_type) remove instance_init
     from the type initialization structure.

 * lasso/xml/saml-2.0/samlp2_authn_request.h,
   lasso/xml/saml-2.0/samlp2_logout_request.h,
   lasso/xml/saml-2.0/samlp2_logout_response.h:
   - (struct _LassoSamlp2*) mark relaystate field as deprecated.
2009-03-27 15:06:10 +00:00
Benjamin Dauvergne 1b550a8606 XML SAML 2.0: Clean query string parsing/building
* lasso/xml/saml-2.0/samlp2_status_response.c:
   - (init_from_query) remove useless stub code for parsing RelayState

 * lasso/xml/saml-2.0/samlp2_response.c,
   lasso/xml/saml-2.0/samlp2_name_id_mapping_response.c,
   lasso/xml/saml-2.0/samlp2_logout_response.c,
   lasso/xml/saml-2.0/samlp2_manage_name_id_response.c, :
   - (class_init) remove overloading of init_from_query, use version
     from samlp2_status_response instead.
   - (init_from_query) Useless so deleted.

 * lasso/xml/saml-2.0/samlp2_request_abstract.c:
   - (class_init) add overloaded method for init_from_query virtual
     method.
   - (init_from_query) generic implementation for SAML 2.0 requests

 * lasso/xml/saml-2.0/samlp2_subject_query_abstract.c,
   lasso/xml/saml-2.0/samlp2_authn_request.c,
   lasso/xml/saml-2.0/samlp2_logout_request.c,
   lasso/xml/saml-2.0/samlp2_manage_name_id_request.c,
   lasso/xml/saml-2.0/samlp2_name_id_mapping_request.c,
   lasso/xml/saml-2.0/samlp2_assertion_id_request.c:
   - (class_init) remove overloading of init_from_query, use version
     from samlp2_request_abstract instead.
   - (init_from_query) Useless so deleted.
2009-03-27 15:06:08 +00:00
Benjamin Dauvergne 8100385979 XML: Remove useless parsing of RelayState in lasso_node_init_from_saml2_query_fields
* lasso/xml/xml.c: (lasso_node_init_from_saml2_query_fields) Since parsing
    of the relayState is now done inside each "_process_*msg" method of
    each SAML2 profile, it is not needed anymore in this function.
2009-03-27 15:06:06 +00:00
Benjamin Dauvergne 27ac758de6 XML: Use memory macros inside lasso_node_export_to_query
* lasso/xml/xml.c (lasso_node_export_to_query): use lasso own memory
   handling macros.
2009-03-27 15:06:03 +00:00
Benjamin Dauvergne 63b38a4066 ID-FF 1.2: review HTTP-Redirect binding parsing/building
* lasso/xml/lib_authn_request.c, lasso/xml/lib_logout_request.c,
   lasso/xml/lib_register_name_identifier_request.c,
   lasso/xml/lib_status_resposne.c:
   - build_query: remove build_query overloaded virtual method, use
     LassoNode new generic implementation.
   - init_from_query:
     - change direct call to lasso_node_init_from_query_fields to use of
       base implementation from LassoNode.
     - make use of utils.h memory handling macros like
       lasso_release_gobject and lasso_assign_string.

 * lasso/xml/lib_federation_termination_notification.c:
   - init_from_query: remove parsing of RelayState parameter
2009-03-27 15:05:59 +00:00
Benjamin Dauvergne d71ff1dec3 ID-FF 1.2: Defederation, changes includes for relative paths
* lasso/id-ff/defederation.c: header path should be relative to the
   implementation, I will try to do it to most files.
2009-03-27 15:05:57 +00:00
Benjamin Dauvergne 6bc8f1a630 ID-FF 1.2: Defederatopm HTTP-Redirect binding, handle relaystate
* lasso/id-ff/defederation.c: get relaystate directly from the query
   string using lasso_get_relaystate_from_query.
2009-03-27 15:05:56 +00:00
Benjamin Dauvergne 88ce5a5669 SAML 2.0: In login change includes for relative paths
* lasso/id-ff/login.c: changes headers for relatives paths
2009-03-27 15:05:55 +00:00
Benjamin Dauvergne bd015db03b Core: Remove ending blanks from erros.c.in
* lasso/errors.c.in: errors.c template contains blanks at end of lines.
2009-03-27 15:05:53 +00:00
Benjamin Dauvergne 88eaabc94d SAML 2.0: add direct treatment of relaystate for HTTP-Redirect binding
* lasso/saml-2.0/login.c: In
  lasso_saml20_login_process_authn_request_msg change handling of
  relayState do not rely upon parsing by the node object, but extract
  directly from the query string. Use new function
  lasso_get_relaystate_from_query.
* lasso/saml-2.0/logout.c: In lasso_saml20_logout_process_request_msg
  change handling of relayState do not rely upon parsing by the node
  object, but extract directly from the query string.
* lasso/saml-2.0/profile.c: In
  lasso_saml20_profile_init_artifact_resolve, add handling of the
  relayState transmitted to the assertion consumer URL.
* lasso/saml-2.0/name_id_management.c: In
  lasso_name_id_management_process_request_msg change handling of
  relayState do not rely upon parsing by the node
  object, but extract directly from the query string.
2009-03-27 15:05:52 +00:00
Benjamin Dauvergne aad866ab67 SAML 2.0: simplify redirect binding code path
* lasso/saml-2.0/login.c, lasso/saml-2.0/logout.c,
   lasso/saml-2.0/name_id_management.c: simplify code path associated
   with generation of the url for the HTTP-Redirect binding using the
   rencently introduced function
   lasso_saml20_profile_build_http_redirect.
2009-03-27 15:05:50 +00:00
Benjamin Dauvergne 64f96e01dc SAML 2.0: remove TODO comment about RelayState
* lasso/xml/saml-2.0/samlp2_status_response.c: do it:)
2009-03-27 15:05:49 +00:00
Benjamin Dauvergne e43ce11311 XML SAML2: Remove unnecessary overloading of build_query in request/respons objects
* lasso/xml/saml-2.0/samlp2_assertion_id_request.c,
   lasso/xml/saml-2.0/samlp2_authn_request.c,
   lasso/xml/saml-2.0/samlp2_logout_request.c,
   lasso/xml/saml-2.0/samlp2_logout_response.c,
   lasso/xml/saml-2.0/samlp2_manage_name_id_request.c,
   lasso/xml/saml-2.0/samlp2_manage_name_id_response.c,
   lasso/xml/saml-2.0/samlp2_name_id_mapping_request.c,
   lasso/xml/saml-2.0/samlp2_name_id_mapping_response.c,
   lasso/xml/saml-2.0/samlp2_response.c,
   lasso/xml/saml-2.0/samlp2_subject_query_abstract.c: remove useless
   overloading of build_query virtual method, revert to implementations
   in LassoSamlp2RequestAbstract and LassoSamlp2StatusResponse.
2009-03-27 15:05:47 +00:00
Benjamin Dauvergne c3b0ca25b8 XML SAML 2.0: add a build query to request base class
* lasso/xml/saml-2.0/samlp2_request_abstract.c: add a build query
   overloaded function to LassoSamlp2RequestAbstract class, the base
   class of all saml 2.0 request nodes.
2009-03-27 15:05:45 +00:00
Benjamin Dauvergne f55ff8ea5e SAML 2.0: Add helper function to implement the HTTP-Redirect binding
* lasso/saml-2.0/profile.c, lasso/saml-2.0/profileprivate.h:
   - remove_all_signature traverse a tree of LassoNode objects to unset
     all signature_type field in on nodes supporting signature
     generation.
   - lasso_saml20_profile_export_to_query does the job of generateing
     the url containing the message content and the relaystate, then
     sign it using lasso_query_sign.
   - lasso_saml20_profile_build_http_redirect use those two functions
     and the metadatas to build the signed redirect url.
2009-03-27 15:05:44 +00:00
Benjamin Dauvergne 71ca7129a6 XML: Add const modifiers to lasso_concat_url_query arguments
* lasso/xml/private.h, lasso/xml/tools.c: add const modifier to
   lasso_concat_url_query arguments.
2009-03-27 15:05:42 +00:00
Benjamin Dauvergne f604d63268 XML: Remove static modifier on lasso_node_build_query
* lasso/xml/private.h, lasso/xml/xml.c: remove static modifier to
   lasso_node_build_query and export it for use in id-ff profiles.
2009-03-27 15:05:41 +00:00
Benjamin Dauvergne 96594a8ede XML: Tool function to extract relaystate from query
* lasso/xml/tools.c, lasso/xml/private.h: new function
   lasso_get_relaystate_from_query to help in relaystate handling.
2009-03-27 15:05:39 +00:00
Benjamin Dauvergne d0d71abe2c Core: rename lasso_release_xmlchar to lasso_release_xml_string
* lasso/id-wsf/wsf_profile.c, lasso/utils.h, lasso/xml/xml.c: rename
   lasso_release_xmlchar to lasso_release_xml_string.
2009-03-27 15:05:37 +00:00
Benjamin Dauvergne 56160b783d Core: Fix double instantiation of macro parameters
* lasso/utils.h:
 - (lasso_assign_new_string,lasso_assign_gobject) if source parameter
   is a function call it could be called two times and have unexpected
   side effects. Copy the returned value to a temp variable and use it
   instead.
2009-03-27 15:05:35 +00:00
Benjamin Dauvergne 7696062fbd Core: Fix corner case in deallocation macros
* lasso/utils.h: When setting strings using lasso_assing_string or
   lasso_assign_new_string, verify that new string is different than the
   target value string before deallocating the target.
2009-03-27 15:05:34 +00:00
Benjamin Dauvergne e59c45e598 Add missing intializations
* initialize local variables.
2009-03-27 15:05:33 +00:00
Benjamin Dauvergne c9011fb16b Core: replace direct use of xmlSecSoap function by wrapper
* lasso/xml/xml.c:
   In lasso_node_init_from_message_with_format remove direct use of
   xmlSecSoap* functions because they emit too much warning by lasso
   reimplementations.
2009-03-27 15:05:31 +00:00
Benjamin Dauvergne f6f8ffcd6e Core: remove use of XPath
* lasso/xml/xml.c:
   in lasso_node_new_from_soap, instead of using XPath use function
   lasso_xml_get_soap_content.
2009-03-27 15:05:29 +00:00
Benjamin Dauvergne dd9382d05b Core: fix comment for lasso_node_init_from_message
* lasso/xml/xml.c:
   state the return code type.
2009-03-27 15:05:28 +00:00
Benjamin Dauvergne c252e5d1c3 Core: remove lasso_node_decrypt implementation
* lasso/xml/xml.c:
   remove code for lasso_node_decrypt.
2009-03-27 15:05:26 +00:00
Benjamin Dauvergne 8fc5cb3f49 Core: make comment agree with the code
* lasso/xml/xml.c:
   change comment about xsi:type handling, we try to honor every
   xsi:type.
2009-03-27 15:05:24 +00:00
Benjamin Dauvergne d8aa0d69a0 Core: remove commented code
* lasso/xml/xml.c:
   remove commented code to handle a specific lasso extension.
2009-03-27 15:05:23 +00:00
Benjamin Dauvergne 642dcfdfbb Core: use lasso_xml_parse_memory instead of xmlParseDoc
* lasso/id-ff/provider.c:
   use internal wrapper instead of direct call to libxml for parsing.
2009-03-27 15:05:21 +00:00
Benjamin Dauvergne 580239d233 Core: move parse xml wrapper from xml.c to tools.c
* lasso/xml/xml.c:
   remove lasso_xml_parse_memory.
 * lasso/xml/tools.c:
   add lasso_xml_parse_memory to wrap xmlParseDocument.
 * lasso/saml-2.0/name_id_management.c:
   use lasso_xml_parse_memory
2009-03-27 15:05:19 +00:00
Benjamin Dauvergne 22feecaffb SAML 2.0 NameIDManagement: use new generic methods
* lasso/saml-2.0/name_id_management.c:
   use new generic methods in lasso_name_id_management_init_request,
   lasso_name_id_management_build_request_msg,
   lasso_name_id_management_process_request_msg,
   lasso_name_id_management_validate_request,
   lasso_name_id_management_build_response_msg,
   lasso_name_id_management_process_response_msg.
   Remove useless boilerplate code.

 * lasso/id-ff/server.c:
 * lasso/id-ff/serverprivate.h:
   last user of lasso_server_nameid_decrypt removed, so remove the code.
2009-03-27 15:05:17 +00:00
Benjamin Dauvergne 32dc71ec3b SAML 2.0 Logout: use generic methods
* lasso/saml-2.0/logout.c:
   use new generic methods in
   lasso_saml20_logout_process_request_msg, and
   lasso_saml20_logout_process_response_msg.
2009-03-27 15:05:16 +00:00
Benjamin Dauvergne 682bc4f6a8 SAML 2.0 Login: use generic methods
* lasso/saml-2.0/login.c:
   use new generic profile methods for saml 2.0 in
   lasso_saml20_login_process_paos_response_msg,
   lasso_saml20_login_process_authn_response_msg,
   lasso_saml20_login_process_response_status_and_assertion.
2009-03-27 15:05:14 +00:00
Benjamin Dauvergne 6ca45dacb1 SAML 2.0: add name id include to login.c
* lasso/saml-2.0/login.c:
   add include saml2_name_id.h
2009-03-27 15:05:13 +00:00
Benjamin Dauvergne 7e9c7112c5 XML SAML 2.0: add a decrypt function to Saml2EncryptedElement
* lasso/xml/saml-2.0/saml2_encrypted_element.c:
   using new function lasso_node_decrypt_xmlnode implement the new
   method, int lasso_saml2_encrypted_element_decrypt(
     LassoSaml2EncryptedElement* encrypted_element,
     xmlSecKey *encryption_private_key, LassoNode **decrypted_node).
   This function is currently not exported by bindings because of the
   last ouput argument which is not supported by the binding generator.
2009-03-27 15:05:11 +00:00
Benjamin Dauvergne d81f986451 SAML 2.0: replace lasso_node_decrypt by lasso_node_decrypt_xmlnode
* lasso/xml/private.h:
 * lasso/xml/tools.c:
   replace implementation of lasso_node_decrypt by a new one called
   lasso_node_decrypt_xmlnode, and use it where old one was used.
2009-03-27 15:05:10 +00:00
Benjamin Dauvergne 5f5ed7fa6a SAML 2.0: reduce code in lasso_assertion_query_process_request
* lasso/saml-2.0/assertion_query.c:
   use new code in SAML 2.0 profile.c to parse requests and decrypt
   nameid, chains calls so that error are kept but all actions are
   accomplished anyway (if first call fails, keep the error but continue
   the processing, then at end return the first returned error).
2009-03-27 15:05:08 +00:00
Benjamin Dauvergne 5d93009e0b SAML 2.0: add internal generic implementation
* lasso/saml-2.0/profile.c:
 * lasso/saml-2.0/profileprivate.h:
   the current effort is to simplify implementation code in saml-2.0 and
   much of the other frameworks. Those new methods:
        lasso_saml20_init_request
        lasso_saml20_profile_process_name_identifier_decryption
        lasso_saml20_profile_process_soap_request
        lasso_saml20_profile_process_soap_response
        lasso_saml20_profile_process_any_request
        lasso_saml20_profile_process_any_response
        lasso_saml20_profile_setup_request_signing
        lasso_saml20_profile_build_request_msg
        lasso_saml20_profile_build_response
        lasso_saml20_profile_init_response
   should help reduce code in login.c, logout.c, name_id_management.c
   and assertion_query.c. They should also permit to make all profiles
   at the same level of binding support
   (GET,REDIRECT,POST,ARTIFACT_GET,ARTIFACT_POST).

   Those function centralize error code handling, initialization of
   commong class (LassoSamlp2StatusResponse and
   LassoSamlp2RequestAbstract) and also the handling of NameID
   decryption.
2009-03-27 15:05:07 +00:00
Benjamin Dauvergne a57841ce69 Core: add new internal macro lasso_extract_node_or_fail
* lasso/utils.h:
   this new macro try to extract a field from a structre (or any
   left-hand-side value), try to typecheck it using 'LASSO_IS_XXX',
   if succesfull, the value is assigned to the variable given as first
   argument or we jump to the 'cleanup' goto label, setting the 4th
   argument as the current error code (value of variable 'rc').
2009-03-27 15:05:06 +00:00
Benjamin Dauvergne dfb0b91ed6 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.
2009-03-27 15:05:04 +00:00