Commit Graph

153 Commits

Author SHA1 Message Date
Benjamin Dauvergne c07cd3898c SAML 2.0&ID-FF 1.2: simplify and complete metadata loading for multi-role support 2010-03-27 16:52:04 +00:00
Benjamin Dauvergne f5442dc84b SAML 2.0: add support for attribute, authentication and authorization authorities metadata
* server.c,serverprivate.h: add new private method
   lasso_server_get_firs_providerID_by_role(server, role)w
 * defederation.c: use new private method
   lasso_server_get_first_providerID_by_role for find providerID
   when the argument remote_providerID is null in
   lasso_defederation_init_notification.
 * lasso/id-ff/login.c (lasso_login_init_authn_request): use new private
   method lasso_server_get_first_providerID_by_role.
 * provider.h: add thre new provider role (authn,pdp,attribute) and
    four new services (authn,assertionid,attribute,authz) and also
    a ROLE_ANY value (-1) for catchall purpose and a ROLE_LAST for
    array sizing.
 * provider.h: add a LAST member to LassoMdProtocolType enum.
  * providerprivate.h,provider.c:
   - removes separate hashtable for descriptors depending on provider role,
     use only one table named Descriptors.
   - use the LAST members of enumerations to dimention static string arrays.
  * provider.h: add a LAST member to the e
2010-03-27 16:51:43 +00:00
Benjamin Dauvergne 95f5d99be6 Core: add missing return value owner semantic annotations to getters
* lasso/id-ff/provider.c:
   fix lasso_provider_get_base64_succinct_id, it returned a libxml
   string, copy it with g_strdup before releasing it to stay with GLib
   allocated string in return values.
2010-02-17 10:14:59 +00:00
Benjamin Dauvergne 0119b91e56 Adapt LassoProvider methods to care for protocol profile version when verifying signature
* lasso/id-ff/provider.c:
   there is now 2 methods to verify signatures, methods calling the old
   one must now choose whether to call the liberty one of the SAML 2.0
   one.
2010-02-10 00:33:49 +00:00
Benjamin Dauvergne 8e1398e65c Core: in provider.c, make lasso_provider_load_metadata_from_buffer the main metadata loading function
* (init_from_xml) fail initialization if we cannot load the metadatas,
   and log a warning.
 * extract _lasso_provider_load_metadata_from_buffer from
   lasso_provider_load_metadata_from_buffer, which accept a length
   parameter. use it inside lasso_provider_load_metadata, instead of
   xmlParseFile.
 * (lasso_provider_load_public_key) use lasso_xmlsec_load_key_info and
   lasso_xmlsec_load_private_key to load the public keys.
2010-02-04 00:02:22 +00:00
Benjamin Dauvergne f520348197 Core: use lasso_node_new_from_dump to implement _new_from_dump methods
* provider.c:
   add annotation for nullable arguments (necessary for bindings of
   new_from_buffer).
 * server.c: add annotations, allow to set encryption_private_key from
   buffers
2010-02-04 00:02:12 +00:00
Benjamin Dauvergne 7aa18e07b1 Fix leaks, change signature of lasso_provider_get_sp_name_qualifier, make it return a const char* 2010-02-04 00:02:05 +00:00
Benjamin Dauvergne fa9566aa59 Core: fix gtk-doc annotations 2010-01-28 15:31:43 +00:00
Benjamin Dauvergne b30498aec6 ID-FF&SAML2: if use is not defined on a key descriptor use the key for any use
* lasso/id-ff/provider.c lasso/saml-2.0/provider.c: if the "use"
   attribute is not set on a KeyDescriptor, use the key for signing and
   encryption.
2010-01-14 16:18:24 +00:00
Benjamin Dauvergne 2ff13e5414 SAML 2.0: overhaul for ubuquitous binding support, still need work for HTTP-Artefact 2010-01-12 15:39:48 +00:00
Benjamin Dauvergne 1dece2447d Core: in provider.c, add lasso_provider_verify_single_node_signature
* lasso/id-ff/provider.c lasso/id-ff/provider.h:
   add a new function to check an enclosed single signature on a
   LassoNode, given that the LassoNode retained its original xml node
   content.
2010-01-04 09:14:25 +00:00
Benjamin Dauvergne e76546078f Core: in provider.c, add accessors for encryption informations
* lasso/id-ff/provider.c:
   add getters for encryption_sym_key_type and encryption_public_key.
 * lasso/id-ff/providerprivate.h:
   declare new accessors.
2010-01-04 09:14:01 +00:00
Benjamin Dauvergne 3c9e4965dd Core: factorize code to obtain a SPNameQualifier
* lasso/id-ff/provider.c lasso/id-ff/provider.h:
   add a method giving the SPNameQualifier for a provider (its entity id
   or its affiliation id).

 * lasso/id-ff/profile.c:
 * lasso/saml-2.0/login.c:
   update use sites.
2009-10-30 14:47:36 +00:00
Benjamin Dauvergne bdd1ad92a0 Core: add const modifier to return value of lasso_provider_get_metadata_list
- lasso/id-ff/provider.c lasso/id-ff/provider.h:
   change return type of lasso_provider_get_metadata_list from GList* to
   const GList*.
 - lasso/id-ff/logout.c lasso/saml-2.0/logout.c
   lasso/saml-2.0/provider.c:
   change consumers of the API
2009-09-29 13:20:40 +00:00
Benjamin Dauvergne 00ea5d7113 Core: Add const modifiers to LassoProvider methods
* lasso/id-ff/provider.c lasso/id-ff/provider.h
   lasso/saml-2.0/provider.c lasso/saml-2.0/provider.h:
   add const modifier where they could be added.
2009-09-29 13:20:38 +00:00
Benjamin Dauvergne c462bc3b2a Do not use g_new, use g_new0
* lasso/id-ff/federation.c:
 * lasso/id-ff/logout.c:
 * lasso/id-ff/profile.c:
 * lasso/id-ff/provider.c:
 * lasso/id-ff/server.c:
 * lasso/id-ff/session.c:
 * lasso/id-wsf/authentication.c:
 * lasso/saml-2.0/ecp.c:
 * lasso/xml/xml.c:
   even for private datas, use g_new0, it is safer.
2009-09-29 13:20:36 +00:00
Benjamin Dauvergne af7feb4670 Add method to Provider to retrieve default NameIDFormat
* lasso/id-ff/provider.c lasso/id-ff/provider.h:
   add lasso_provider_get_default_name_id_format, which returns the firs
   listed NameIDFormat from the SAML 2.0 metadatas of the provider.
2009-09-29 13:20:31 +00:00
Benjamin Dauvergne 77a1233080 Fix bugs found via coverity (thanks to Bhaskar Jain)
* lasso/id-wsf-2.0/data_service.c: fix uninitialized res variable in
   lasso_idwsf2_data_service_process_query_response_soap_fault_msg.
 * lasso/xml/saml-2.0/saml2_assertion.c: fix uninitialized rc variable
   in get_xmlNode.
 * lasso/saml-2.0/login.c:
   in lasso_saml20_login_accept_sso check for ni and ni->Format
   null-ness before dereferencing, remove idp_ni which is not used
   anymore.
   remote all use of federation->remote_nameIdentifier, SAML 2.0 only
   need one NameID, and it will be local_nameIdentifier.
 * lasso/xml/xml.c:
   in lasso_node_traversal, check null-ness of node before dereferencing
   it, add check for class null-ness also.
 * lasso/id-ff/provider.c:
   in lasso_provider_get_first_http_method, remove useless check for t2
   null-ness -- if found is TRUE, t1 and t2 cannot be null.
 * lasso/xml/tools.c:
   in lasso_sign_node, add documentation, check for private_key_file and
   xmlnode null-ness.
   in lasso_get_public_key_from_private_key_file, add a cleanup phase,
   check for cert variabl null-ness befor appending, count the number of
   certificates added.
   in lasso_query_verify_signature, check that URL unescaping and base64
   decoding are succesfull before using the decoded strings.
 * lasso/saml-2.0/name_id_management.c:
   in lasso_name_id_management_validate_request, fix mis-handling of
   federation, if federation does not match request name_id, return
   UNKNOWN_PRINCIPAL.
2009-09-17 15:05:50 +00:00
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 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 52e60ecb09 Rework cleanup handling
* lasso/utils.h:
   change 'goto exit' for 'goto cleanup'. rename all goto_exit macros to
   goto_cleanup_.  rename goto_cleanup_if_fail to
   goto_cleanup_if_fail_with_rc and add a
   goto_cleanup_if_fail for function which do not return an integer
   value. add documentation for goto_cleanup macro family.
 * lasso/id-ff/login.c:
 * lasso/id-ff/provider.c:
 * lasso/id-ff/server.c:
 * lasso/id-ff/session.c:
 * lasso/id-wsf/discovery.c:
 * lasso/id-wsf/wsf_profile.c:
 * lasso/saml-2.0/profile.c:
 * lasso/utils.h:
 * lasso/xml/lib_logout_request.c:
 * lasso/xml/tools.c:
 * lasso/xml/xml.c:
   update name of goto_exit_if_fail macros. rename 'exit' labels to
   'cleanup'.
2009-04-22 23:49:29 +00:00
Benjamin Dauvergne a68c89f902 ID-FF 1.2: fix style fault
* lasso/id-ff/defederation.c:
 * lasso/id-ff/logout.c:
 * lasso/id-ff/profile.c:
 * lasso/id-ff/provider.c:
 * lasso/id-ff/server.c:
   add missings casts, remove useless wrappers
 * lasso/id-ff/logout.c:
   In lasso_logout_process_request_msg change sequence of "if" for a
   "switch".
2009-03-27 15:06:29 +00:00
Benjamin Dauvergne 3caee2835d ID-FF 1.2: fix some real and potential memory leaks
* lasso/id-ff/provider.c:
 * lasso/id-ff/server.c:
 * lasso/id-ff/session.c:
   use macros to release previous value when necessary,
   release object used as parameters to constructors,
   free the encryption key associated with a provider,
   release the key manager created for a saml signature
   verification.
2009-03-27 15:06:27 +00:00
Benjamin Dauvergne e59c45e598 Add missing intializations
* initialize local variables.
2009-03-27 15:05:33 +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 a475d9eb00 Core: add new internal API lasso_provider_verify_query_signature
* lasso/id-ff/provider.c:
   try to keep some homgeneity between lasso_verify_signature and
   lasso_verify_query_signature functions, by having mirror methods
   inside the LassoProvider class. this new methods comes with complete
   documentation.
 * lasso/xml/tools.c:
   add a xmlDoc argument to lasso_verify_signature, in order to
   reuse an already built message context, and possible problems with
   interned string in parsed xml documents.
2009-03-27 15:05:00 +00:00
Benjamin Dauvergne 3b2f3fbced Core: add xmlDoc parameter to lasso_provider_verify_saml_signature
* lasso/id-ff/provider.c:
   add an xmlDoc parameter to lasso_provider_verify_saml_signature,
   reflecting change in lasso_verify_signature.
   fix memory leaks of an xmlSecKeysMngr.
   complete arguments checking.
 * lasso/id-ff/login.c:
   update use of lasso_provider_verify_signature in LassoLogin
2009-03-27 15:04:58 +00:00
Benjamin Dauvergne b09ef2e015 Core: do not mix public and private headers
* lots of files:
   explicitely load the internal header xml/private.h where needed.
2009-03-27 15:04:26 +00:00
Damien Laniel 5aafc13002 documentation-related fixes 2009-01-26 16:42:19 +00:00
Benjamin Dauvergne fdc8c66a98 XML: new LassoProvider API to verify XMLDsig signatures
* lasso/id-ff/provider.c, lasso/id-ff/providerprivate.h:
  - (lasso_provider_verify_saml_signature) validate a signed
    saml Request, Response or Assertion, using the public key
    of the given provider.
2009-01-24 09:33:55 +00:00
Benjamin Dauvergne 33bbf7a7de All: Fix missing field initializer problems
* lots of files: Explicitely set all field of initialized structures,
  in order to remove -Wno-missing-field-initilizers from needed
  compiler options when using -Wall -Wextra.
2009-01-24 09:33:40 +00:00
Benjamin Dauvergne d01eec1b57 Add missing intialization
- lasso/id-ff/provider.c,lasso/id-ff/server.c: add missing initialization
   of return code variable.
2008-11-05 23:38:26 +00:00
Benjamin Dauvergne aff32ad997 Add log message in the metadata loading process
- lasso/id-ff/provider.c, lasso/saml-2.0/provider.c: add critical log
   message in each failed loading of metadatas branch cases.
2008-11-05 11:23:29 +00:00
Benjamin Dauvergne a30f9f6b9e Fix uninitialized return code
Thanks Emmanuel Dreyfus
2008-11-05 11:23:26 +00:00
Benjamin Dauvergne 7103e81888 Change style of error and dellocation handling
- lasso/id-ff/provider.c:
   - in lasso_provider_verify_signature use standardised memory and
     error handling macros, and also standard return code variable name
     and exit label.
   - in lasso_providerl_load_metadata_from_buffer and
     lasso_provider_load_metadata use the standardised macros, exit
     labels and return code variable.
 - lasso/id-ff/server.c:
   - in lasso_server_load_affiliation use standardised allocation and
     error handling macros.
 - lasso/id-wsf/wsf_profile.c:
   - use standardised memory and error handling macros in
     lasso_wsf_profile_build_soap_request_msg.
2008-11-04 01:58:53 +00:00
Benjamin Dauvergne 0d66367f28 Remove use of xmlFreeDoc for lasso_release_doc
- bindings/java/wrapper_top.c, bindings/php4/lasso_php4_helper.c,
    bindings/php5/wrapper_source_top.c, bindings/python/wrapper_top.c,
    lasso/id-ff/identity.c, lasso/id-ff/lecp.c, lasso/id-ff/login.c,
    lasso/id-ff/logout.c, lasso/id-ff/name_registration.c,
    lasso/id-ff/profile.c, lasso/id-ff/provider.c, lasso/id-ff/server.c,
    lasso/id-ff/session.c, lasso/id-wsf-2.0/data_service.c,
    lasso/id-wsf/data_service.c, lasso/id-wsf/discovery.c,
    lasso/id-wsf/wsf_profile.c, lasso/saml-2.0/ecp.c,
    lasso/saml-2.0/login.c, lasso/saml-2.0/name_id_management.c,
    lasso/utils.h, lasso/xml/tools.c, lasso/xml/xml.c, swig/Lasso.i:
    Remove use of xmlFreeDoc. Use lasso_release_doc instead.
2008-11-04 01:58:49 +00:00
Benjamin Dauvergne 618639623c LassoServer init_from_xml/new_from_buffer handling
* lasso/id-ff/server.c: (init_from_xml) if load_metadata fail
  try load_metadata_from_buffer instead using the content of the dumped
  nodes.
2008-11-02 11:49:58 +00:00
Benjamin Dauvergne 5f163bbffd Add new constructor lasso_server_new_from_buffers
* lasso/id-ff/server.c, lasso/id-ff/server.h: add new function to build
   a LassoServer object holding content of certificate and private key
   files intead of loading them everytime signing is needed. You must
   instead load them yourself the first time.
2008-11-02 11:49:56 +00:00
Benjamin Dauvergne 810f2a9bf9 Add verification of access before calling libxml loading function
* lasso/id-ff/provider.c: (lasso_provider_load_metadata) libxml emit warning
  when trying to parse non-existing or non-accessible file, so verify
  that the file is accessible before calling libxml. (the corner
  case of having warning when the file become inaccessible between
  the two calls is non-interesting)
2008-11-02 11:49:53 +00:00
Benjamin Dauvergne ef42f2cbc8 add functionality to enable debugging flags at runtime
This code permit to set flags, separated by commas, space,
tabulations, or colons. This flags activates debug functions like,
suppressing validations of signatures or print debugging message about
deallocations.

The new flags are defined in /lasso/debug.h they can be set using an
environment variable named LASSO_FLAG or a function named
lasso_set_flag.

There are two flags currently:
- verify-signature:
  To deactivate it, pass 'no-verify-signature' inside LASSO_DEBUG.
  It desactivate signature verification, inside two functions:
  lasso_query_verify_signature and lasso_provider_verify_signature.
- memory-debug:
  It enabled reporting of memory deallocation inside generic memory
  dellaocator for LassoNode objects and also in bindings.

- lasso/xml/xml.c: do not free a null hash table pointer.
2008-10-01 10:31:58 +00:00
Benjamin Dauvergne 152ec6d42e Many fix to compile with --enable-wsf and --enable-debugging and also to
remove valgrind errors through python tests.

1. Rename lasso_wsf_profile_new_full for java bindings (cannot subclass
   in overrides of static methods).
2. Add const modifiers to many functon signatures in
   bindings/python/wrapper_top.c.
3. add initialisation of private_data->encryption_sym_key_type (to
   please valgrind) in instance_init of LassoProvider.
4. Add new macro to assign xmlNode, we consider xmlNode to be an
   immutable value, and always use xmlCopyNode for assignment. The
   macros is called named lasso_assign_node.
5. Fix segfault, when using xmlSec to encrypt the newly created
   encrypted node replace the original node inside the xmlDoc structure,
   and the original node is freed automatically. So you cannot borrow
   the encrypted if you do not remove it from xmlDoc first.
2008-09-23 09:13:09 +00:00
Damien Laniel db5d229004 free xmlDoc only once 2008-09-17 13:14:12 +00:00
Damien Laniel cd5bbfe187 fixed docstring 2008-09-17 12:40:12 +00:00
Benjamin Dauvergne 9ed0670e48 * Remove ending blanks 2008-09-12 15:06:58 +00:00
Benjamin Dauvergne ae1f6a297c * Remove warnings:
- remove unused parameter from private function signatures
 - remove unused variable
 - initialize variable potentially accessed uninitialized
 - add G_GNUC_UNUSED if function is public or adhering to an interface, and a
   parameter is unused.
 - if ID-WSF is not compiled in, define stubs with G_GNUC_UNUSED on parameters.
 The goal is to compile with -Werror.
2008-09-12 13:57:22 +00:00
Benjamin Dauvergne 24430806e6 Fix regression when loading a LassoServer from dump.
Fix an error with -rpath setting in last commit, -rpath must always be absolute
paths.
2008-09-04 09:44:34 +00:00
Benjamin Dauvergne 500480afbf Add public function lasso_server_add_provider_from_buffer, to add a provider
from an XML string of the metadatas (changed semantic of the second argument
compared to lasso_server_add_provider). To support this a new public
LassoProvider constructor was added: lasso_provider_new_from_buffer, where the
second argument is an XML string. It uses a new private function,
lasso_provider_load_metadata_from_buffer.
2008-08-26 12:48:58 +00:00
Benjamin Dauvergne 207891ff29 * Fix blanks mismatch (space in *.c and *h files or tabs in *.py files) and formatting 2008-08-05 14:53:29 +00:00
Frédéric Péters e5ba6151ba moved gtk-doc inline as is better on so many points; also added schema
fragments to published doc
2008-05-15 21:17:44 +00:00
Benjamin Dauvergne cc5109ee93 change g_return_val_if_fail(provider,... from last commit to g_return_val_if_fail(LASSO_IS_PROVIDER(provider) 2008-04-24 09:02:34 +00:00