Commit Graph

4230 Commits

Author SHA1 Message Date
Benjamin Dauvergne 7231771856 All: Rework include files handling, separated ID-WSF code from SAML2/ID-FF code
* nearly all C files: change includes for relative paths.
 * lasso/id-wsf/id_wsf.h, lasso/id-wsf-2.0/id_wsf_2.h: add top level
   public include files for ID-WSF 1.0 and ID-WSF 2.0.
 * lasso/id-ff/server.*, lasso/id-ff/session.*, lasso/id-ff/identity.*:
   remove most of the code related to ID-WSF and push into
   lasso/id-wsf/id_ff_extensions.* and lasso/id-wsf-2.0/identity.c,
   lasso/id-wsf-2.0/server.c, lasso/id-wsf-2.0/session.c.
 * lasso/id-wsf-2.0/saml2_login.c,
   lasso/id-wsf-2.0/saml2_login_private.h: same change but for ID-WSF
   2.0 support in SAML2 SSO profile.
2009-08-26 15:14:32 +00:00
Benjamin Dauvergne b763241411 Bindings: skip ID-WSF methods with unsupported signatures
* bindings/overrides.xml:
   some functions have output parameters (pointer on pointers) that are
   currently not supported by our binding generator, so we skip them.
2009-08-26 15:14:20 +00:00
Benjamin Dauvergne 2888e14ae6 SWIG: unplug id-wsf support in SWIG
* swig/Lasso.i:
   force LASSO_WSF_ENABLED to be undefined.
2009-08-26 15:14:17 +00:00
Benjamin Dauvergne a2abe27a68 Tests: allow tests2 to pass distcheck
* tests/Makefile.am
   add an SRCDIR symbol.
   remove unused include paths.
 * tests/tests2.c:
   use SRCDIR to find data files.
2009-08-26 15:14:14 +00:00
Benjamin Dauvergne e1470be969 Tests: remove internal content from data files
* tests/data/response-3:
   this dump of a SAML message contains elements and attribute outside
   the SAML schema, implementation detail from Lasso. They broke
   execution of tests/tests2.
2009-08-26 15:14:12 +00:00
Benjamin Dauvergne 80f75007c3 XML&SAML 2.0: add missing include files
* lasso/xml/saml-2.0/saml2_encrypted_element.h:
   xmlSecKey is present in a function signature, so include
   xmlsec/xmlsec.h.
2009-08-26 15:14:09 +00:00
Benjamin Dauvergne 49c9dd5d05 SWIG: implement change to LassoSession in the SWIG interface file
* swig/Lasso.i:
   remove LassoSession::is_dirty attribute and rewrite the
   getProviderIds function.
2009-08-26 15:14:06 +00:00
Benjamin Dauvergne fe6922951f XML: only recurse into xml/id-wsf subdirs if --enable-wsf is true
* lasso/xml/Makefile.am:
   put id-wsf and id-wsf2 subdirs under a conditionnal.
2009-08-26 15:14:04 +00:00
Benjamin Dauvergne 45755ffa99 ID-WSF 1.0: remove absent header file from the Makefile.am
* lasso/id-wsf/Makefile.am:
   remove data_service_private.h from header file list.
2009-08-26 15:14:02 +00:00
Benjamin Dauvergne eacb57905c Core: SOAP is also used by SAML bindings
* extract_symbols.py, extract_types.py:
   export SOAP types whatever the value of the flag --enable-wsf.
   It still worked because constructor for GObject calls get_type, but
   there is a race condition: if you receive a SOAP message before
   sending one, it fails. Only soap_binding types must be removed.
2009-08-26 15:13:59 +00:00
Benjamin Dauvergne fbfbe5553d ID-FF&Core: Seal public field of LassoSession
* id-ff/session.h: seal public fields.

 * id-ff/session.c, id-ff/sessionprivate.h: add accessors for reading
   the is_dirty flag and counting store assertions.

 * id-ff/logout.c, id-ff/login.c, saml-2.0/login.c, saml-2.0/logout.c,
   saml-2.0/profile.c: use the new accessors.

 * id-ff/profile.c: include the private header file, use the new
   accessors, and remove unnecessary setting of is_dirty to FALSE (it
   should be false at instanciation).

 * utils.h: add a macro to access private content, prepare for using
   G_TYPE_INSTANCE_GET_PRIVATE and the GObject infrastructure for
   private structures eventually.
2009-08-26 15:13:55 +00:00
Benjamin Dauvergne a3c4a339f2 ID-WSF 2.0: remove unused variable
- lasso/id-wsf-2.0/discovery.c: remove unused variable in discovery.c
2009-08-26 15:13:51 +00:00
Benjamin Dauvergne c150172504 Core: fix bad name of lasso_unlink_and_release_node
* lasso/utils.h:
   - rename lasso_unlink_and_release_node to
     lasso_release_list_of_xml_node.
   - add a GList iteration macro: lasso_foreach.
2009-08-26 15:13:49 +00:00
Benjamin Dauvergne 55f2051534 ID-WSF: Lots of modifications
Migrate lots of code to use new utility macros. Try to simplify most
 code paths or to factorize with LassoWsfProfile.

 * lasso/id-wsf/wsf_profile.c:
   Add API:
    - lasso_wsf_profile_build_soap_response_msg to build SOAP fault for
      Lasso errors,
    - lasso_wsf_profile_set_msg_url_from_description, to set the
      destination URL using the chosen LassoDiscoDescription (with
      respect to the security mechanism),
    - lasso_wsf_profile_init_soap_response to initialize a response to
      the current request, to use in sub classes,
    - lasso_wsf_profile_get_remote_provider_id, retrieve the SOAP
      binding corresponding information,
    - lasso_wsf_profile_get_remote_provider, simplification of
      lasso_wsf_profile_get_remote_provider_id,
    - lasso_wsf_profile_get_soap_fault, retrieve the last setted SOAP
      fault, used by sub classes,
    - lasso_wsf_profile_set_soap_fault, set a SOAP fault, to be returned
      by the next call by lasso_wsf_profile_build_soap_response_msg, to
      use in sub classes,
    - lasso_wsf_profile_set/get_status_code, set/get the stored status
      code, to use in the next lasso_xxx_build_response_message, to use
      in sub classes.
   Change name lasso_wsf_profile_get_description_autos to
   lasso_wsf_profile_get_description_auto.
   Do not access directly the session is_dirty field (it has been
   sealed).

 * lasso/id-wsf/wsf_profile.h:
   Add helper macro lasso_wsf_profile_helper_set_status to set status
   code of an ID-WSF response message containing a Status element using
   the stored status code.
 * lasso/id-wsf/wsf_profile_private.h:
   Add new fields (moved public fields).
   Add lasso_wsf_profile_set_msg_url_from_description,
   lasso_wsf_profile_build_soap_fault_response_msg.
 * lasso/id-wsf/data_service_private.h:
   Remove file.
 * lasso/id-wsf/data_service.h: Remove all public fields.
 * lasso/id-wsf/data_service.c:
   Remove private structure. Use the equivalents LassoWsfProfile private
   fields. Update documentation. Use LassoWsfProfile generic functions
   for initializing requests. Add API lasso_data_service_get_query_item,
   lasso_data_service_get_answers, lasso_data_service_get_answer,
   lasso_data_service_get_answers_by_select,
   lasso_data_service_get_answer_for_item_id,
   lasso_data_service_add_modification.
   Remove lasso_data_service_need_redirect_user use equivalent function
   lasso_interaction_profile_service_build_redirect_response_msg. Remove
   lasso_data_service_get_resource_offering,
   lasso_data_service_set_offering.
 * lasso/id-wsf/discovery.c:
   Add documentation. Change some signatures. Remove
   lasso_discovery_get_description_auto. Change name of
   lasso_discovery_init_insert to lasso_discovery_init_modify. Add a
   generic lasso_discovery_process_request_msg.
   Add internal function lasso_discovery_init_offering, to get
   automatically an offering if possible. Remove useless init_from_xml.
   Rework lasso_discovery_build_credential implementation.
   overloading. Remove lasso_discovery_destroy.
 * lasso/id-wsf/discovery.h:
   Remove lasso_discovery_destroy.
 * lasso/id-wsf/interaction_profile_service.c:
   Add lasso_interaction_profile_service_build_redirect_response_msg.
 * lasso/id-wsf/personal_profile_service.c:
   Update lasso_personal_profile_service_get_email to use
   lasso_data_service_get_answers_by_select.
 * lasso/xml/dst_modify.c:
   make modification parameter optional to the constructor.
2009-08-26 15:13:46 +00:00
Benjamin Dauvergne 59926d7545 Core: Add new error types
* lasso/errors.h lasso/errors.c:
   add error types: LASSO_ERROR_CAST_FAILED,
   LASSO_DATA_SERVICE_CANNOT_ADD_ITEM,
   LASSO_WSF_PROFILE_ERROR_INVALID_OR_MISSING_REFERENCE_TO_MESSAGE_ID,
   LASSO_DST_ERROR_QUERY_NOT_FOUND, LASSO_DST_ERROR_NO_DATA,
   LASSO_DST_ERROR_MALFORMED_QUERY.
2009-08-26 15:13:43 +00:00
Benjamin Dauvergne de375da682 XML: Add time formatting function for ISO 8601 format
* xml/private.h:
 * xml/tools.c:
   add util function to format time_t values in the ISO 8601 format.
2009-08-26 15:13:41 +00:00
Benjamin Dauvergne 667a1448cd XML: Add any attribute parsing to Saml2AttributeValue
* xml/saml-2.0/saml2_attribute_value.h:
   add new public field GHashTable *attributes;
 * xml/saml-2.0/saml2_attribute_value.c:
   add parsing instructions to populate attributes field.
2009-08-26 15:13:39 +00:00
Benjamin Dauvergne 713ae637a8 XML: add documentation for lasso_eval_xpath_expression
* lasso/xml/tools.c: add documentation for xpath helper evaluation
  function lasso_eval_xpath_expression.
2009-08-26 15:13:36 +00:00
Benjamin Dauvergne 204e99ab34 XML: add string constant for client soap errors
* lasso/xml/strings.h: add new string constant
  LASSO_SOAP_FAULT_CODE_CLIENT.
2009-08-26 15:13:33 +00:00
Benjamin Dauvergne 33576b629a XML: add documentation for lasso_idwsf2_disco_svc_md_register_new_full
* lasso/xml/id-wsf-2.0/disco_svc_md_register.c: add documentation
  for constructor function lasso_idwsf2_disco_svc_md_register_new_full.
2009-08-26 15:13:30 +00:00
Benjamin Dauvergne c01a0e78fa ID-WSF 1.0: Add new error to signal unknown entry
* lasso/errors.{c,h}: add a new error for the ID-WSF 1.0 module, to
  signal unknown entry in discovery responses.
2009-08-26 15:13:28 +00:00
Benjamin Dauvergne 666290fb1d SWIG Binding: reflect changes in the signature of struct LassoIdWsfDiscovery
* swig/Lasso-wsf2.i (LassoIdWsfDiscovery):
   add new fields metadatas and svcMDIDS, remove old ones (metadata
   and svcMDID).
2009-08-26 15:13:25 +00:00
Benjamin Dauvergne 3da34a1b0d ID-WSF 1.0: fix off-by one ref counting error in lasso_wsf_profile_init_soap_request
* lasso/id-wsf/wsf_profile.c (lasso_wsf_profile_init_soap_request):
   envelope is an argument, increment its ref count
   before storing it.
2009-08-26 15:13:23 +00:00
Benjamin Dauvergne e3bf5c88d5 ID-WSF 1.0: improve error recovery in lasso_wsf_profile_comply_with_saml_authentication
* lasso/id-wsf/wsf_profile.c
   (lasso_wsf_profile_comply_with_saml_authentication):
   reuse existing wsse-security element if present,
   remove useless comments, move core code after argument type checks,
   return error if enveloppe or header is missing,
   fail if any referenced assertion is missing,
   correctly handle reference count of wsse_security depending on
   the situation (new or reused).
2009-08-26 15:13:21 +00:00
Benjamin Dauvergne d4e28010be ID-WSF 1.0: fix memory leak
* lasso/id-wsf/discovery.c (lasso_discovery_add_insert_entry):
   the rule is that callee is responsible for becoming owner of a resource,
   so no g_object_ref before a call on an argument.
2009-08-26 15:13:18 +00:00
Benjamin Dauvergne fee8ff9acf ID-WSF 2.0: publicize lasso_idwsf2_profile_build_soap_envelope
* lasso/id-wsf-2.0/profile.c, lasso/id-wsf-2.0/profile.h
   (lasso_idwsf2_profile_build_soap_envelope):
   as for ID-WSF 1.0 export this function to allow easier implementation
   of external ID-WSF 2.0 services. remove FIXME comment and fill
   equivalent bugzilla reports.
2009-08-26 15:13:16 +00:00
Benjamin Dauvergne 562be4b08a ID-WSF 2.0: review lasso_idwsf2_discovery_process_metadata_register_response_msg
* lasso/id-wsf-2.0/discovery.c
   (lasso_idwsf2_discovery_process_metadata_register_response_msg):
   change return code variable to rc, move argument casting after argument
   type check, copy all the service metadata ids,
2009-08-26 15:13:13 +00:00
Benjamin Dauvergne be6342b39a ID-WSF 2.0: review lasso_idwsf2_discovery_process_metadata_register_msg
* lasso/id-wsf-2.0/discovery.c
   (lasso_idwsf2_discovery_init_metadata_register):
   add documentation comment, move argument casting after type checking,
   change return code name to rc to comply with standardisation,
   use lasso_build_unique_id instead of duplicating the code,
   add iteration over all the registered service, add iteration
   to return all the generated service metadata ids, use new assignment
   macros.
 * lasso/id-wsf-2.0/discovery.h (struct _LassoIdWsf2Discovery):
   change field LassoIdWsf2DiscoSvcMetadata metadata to GList* metadatas
   and gchar *svcMDID to GList *svcMDIDs in order to support multiple
   services in requests.
2009-08-26 15:13:11 +00:00
Benjamin Dauvergne 714248160f ID-WSF 2.0: review lasso_idwsf2_discovery_metadata_register_self
* lasso/id-wsf-2.0/discovery.c
   (lasso_idwsf2_discovery_metadata_register_self):
   Add documentation, add code for getting the service URL.
2009-08-26 15:13:07 +00:00
Benjamin Dauvergne ecac419fa2 ID-WSF 2.0: add documentation to lasso_idwsf2_discovery_register_self
* lasso/id-wsf-2.0/discovery.c (lasso_idwsf2_discovery_register_self)
   move casting after argument type check, simplify code by using
   lasso_build_unique_id, remove useless comments
2009-08-26 15:13:05 +00:00
Benjamin Dauvergne 601d6da24d ID-WSF 2.0: simplify gobject boilerplate
* lasso/id-wsf-2.0/discovery.c: (get_xmlNode, instance_init, class_init)
   remove useless method get_xmlNode, remove useless NULLing or
   instance fields.
2009-08-26 15:13:02 +00:00
Benjamin Dauvergne b7d4e1b3e9 ID-WSF 2.0: use new macros
* lasso/id-wsf-2.0/data_service.c (lasso_idwsf2_data_service_init_query,
   lasso_idwsf2_data_service_parse_query_items,
   lasso_idwsf2_data_service_init_modify,
   lasso_idwsf2_data_service_parse_one_modify_item,
   lasso_idwsf2_data_service_parse_modify_items):
   add cast, change macros for stealing version, fix name of macro
 * lasso/id-wsf-2.0/profile.c: (lasso_idwsf2_profile_init_soap_request)
   use list handling macro, add missing casts
 * lasso/id-wsf-2.0/discovery.c:
   (lasso_idwsf2_discovery_process_metadata_association_add_msg,
    lasso_idwsf2_discovery_init_query) add missing casts
2009-08-26 15:12:58 +00:00
Benjamin Dauvergne 09de7ab8b3 ID-WSF 2.0: add a new constructor for UtilStatus
- lasso/xml/id-wsf-2.0/utils_status.h (lasso_idwsf2_util_status_new_with_code):
   this constructor allow to construct and fill a UtilStatus node with
   one line. It has two arguments to construct nested two level
   status objects (with two status codes). If you omit the second
   argument you get a one level status object.
2009-08-26 15:12:55 +00:00
Benjamin Dauvergne 526962420c ID-WSF 2.0: add initialization of local variables 2009-08-26 15:12:52 +00:00
Benjamin Dauvergne 78453bd8f7 ID-WSF 2.0: Use new XPath API in DST
- lasso/id-wsf-2.0/data_service.c:
   - lasso_idwsf2_data_service_parse_query_items: use the new API to
   remove error outputs from libxml, and generate an additional status
   code containing newly returned libxml error code.
   - lasso_idwsf2_data_service_parse_one_modify_item: use the new API.
2009-08-26 15:12:49 +00:00
Benjamin Dauvergne 28bdebee52 XML: add API to simplify evaluation of XPath expressions
* lasso/xml/tools.c,lasso/xml/private.h:
  - lasso_eval_xpath_expression(xmlXPathContextPtr xpathCtx,
    const char *expression, xmlXPathObjectPtr *xpathObjectPtr,
    int *xpathErrorCode) is a boolean returning function handling call
    to libxml API to evaluate en XPath expression in the xpathCtx
    context. It eventually save the returned nodeset in the variable
    pointed by xpathObjectPtr if it is not-NULL
    (and eventually deallocate previous value)
    and if an error happend it copy its code into the variable
    pointed to by xpathErrorCode if it is not NULL.
2009-08-26 15:12:46 +00:00
Benjamin Dauvergne 44a26b40e1 Tests: Add a fourth data loading test
* tests/data/response-4: test content
 * tests/tests2.c: add loading of the new file.
2009-08-26 15:12:41 +00:00
Benjamin Dauvergne c4e3d95429 Only recurse into id-wsf if it is enabled
* lasso/Makefile.am:
   only add id-wsf and id-wsf-2.0 to SUBDIRS if wsf is enabled.
2009-07-06 16:06:03 +00:00
Benjamin Dauvergne 0d3977f21f Fix: backward_comp.h is missing from tarballs.
* lasso/Makefile.am:
   add backward_comp.h to EXTRA_DIST
2009-07-06 16:06:02 +00:00
Benjamin Dauvergne 28bf7912f0 Python Binding: fix bug of uninitialized ppos argument to PyDict_Next
* bindings/pyhton/wrapper_top.c (set_hashtable_of_pygobject):
   second argument (int*ppos) of PyDict_Next must be reinitialized to
   zero before each traversal (see Python C API
   http://docs.python.org/c-api/dict.html).

   Patch from Iban Rodríguez of the Desarrollo de Producto Electrónico,
   Spain.
2009-06-15 12:38:16 +00:00
Benjamin Dauvergne f5d0b4e343 Update doap file 2009-06-15 12:27:52 +00:00
Benjamin Dauvergne 8841328655 Do not remove signatures on assertion when using HTTP Redirect
* lasso/saml-2.0/profile.c:
   HTTP Redirect binding mandate to remove signature at the SAML message
   level, but signatures at the assertion, especially if the SP asked for
   it, must be preserved.
2009-06-15 12:27:50 +00:00
Benjamin Dauvergne b48323a2a0 Fix bug in lasso_registry_destroy / shutdown
* lasso/registry.c:
   if not initialized, do not free. do not segfault on NULL argument.
2009-05-07 12:36:02 +00:00
Benjamin Dauvergne 81bc017436 Do not respect default semantic of dst:Query
* lasso/id-wsf-2.0/data_service.c:
   the specification for data service template indicat that the query
   must fail at the first failing query, we think this is a stupid
   behaviour so I set the default to keep running query until the last
   one and returning a partial result if at least one failed and a
   failed result if absolutely no query matched.
 * lasso/id-wsf-2.0/private.h:
   declare the lasso_flag_follow_id_wsf_supid_semantic flag.
 * lasso.c:
   declare the lasso_flag_follow_id_wsf_supid_semantic flag, it's
   conditionned by the LASSO_WSF_ENABLED preprocessor symbol.
2009-05-07 12:36:00 +00:00
Benjamin Dauvergne a4e03e7626 Add valgrind support to integration tests
* tests/integration/saml2/__init__.py:
   if /usr/bin/valgrind exist, use script valgrind-wrapper.sh to launch
   tests, it stores log files in {authentic,lcs}_$ISODATE_pid$PID.log.
2009-04-30 14:58:24 +00:00
Benjamin Dauvergne 7e4a554d61 Fix leak in python binding
* bindings/python/wrapper_top.c:
   keep a pointer on beginning of list to free it.
2009-04-30 14:58:23 +00:00
Benjamin Dauvergne 1b0d28b102 Fix leak of mapping registry
* lasso/lasso.c:
 * lasso/registry-private.h:
 * lasso/registry.c:
   make the registry be freed in lasso_shutdown.
2009-04-30 14:58:22 +00:00
Benjamin Dauvergne e3bdadf8f7 ID-FF 1.2: Fix leaks, reduce code
* id-ff/login.c:
 * id-ff/logout.c:
 * id-ff/profile.c:
 * id-ff/provider.c:
 * id-ff/server.c:
   fix leaks by using field setting macros which frees previous values,
   it also reduce code length sometimes.
2009-04-30 14:58:20 +00:00
Benjamin Dauvergne 7071a9ce9a Export the new flag
* lasso/debug.h:
   export new flag lasso_flag_sign_messages.
2009-04-30 14:58:17 +00:00
Benjamin Dauvergne 7e6dfb7683 Fix leaks in tests
* basic_tests.c:
 * login_tests.c:
 * login_tests_saml2.c:
 * random_tests.c:
   free replaced string, unref used nodes, initialize local variables
   when necessary, free newly allocated strings.
2009-04-30 14:58:16 +00:00