Commit Graph

183 Commits

Author SHA1 Message Date
Benjamin Dauvergne 18a10593fc [provider] fix doc comment 2011-12-08 18:11:46 +01:00
Benjamin Dauvergne 5e5c38b451 [core] rename lasso_provider_set_specific_signing_key to lasso_provider_set_server_signing_key 2011-12-05 14:25:34 +01:00
Benjamin Dauvergne 57241e3e86 [core] add lasso_provider_add_key to add other key for signature validation
The added key can be appended or prepended, depending on the need for the key:
 - rollover
 - improving performances (using simpler cryptographic algorithmss using shared secret keys)
2011-12-05 12:03:31 +01:00
Benjamin Dauvergne 109c562260 [core] add method lasso_provider_set_specific_signing_key
Using this method you can specify a signing which will be used for
communication with the specified provider instead of the one configured
on the LassoServer object. The main objective is to allow shared secret
cryptography instead of public key cryptography.
2011-12-05 12:03:14 +01:00
Benjamin Dauvergne cd017964d0 [core] introduce the LassoSignatureContext context, to pass around signature parameters
This structure is used to pass around the signature algorithm
and the signature key.
2011-12-05 12:03:13 +01:00
Benjamin Dauvergne dfacafb3b0 [core] replace explicit allocation of LassoProviderPrivate by use of g_type_class_add_private
The private part is allocated contiguously to the public structure data.
2011-12-05 12:03:13 +01:00
Benjamin Dauvergne ad51948373 [core] simplify lasso_provider_load_public_key 2011-12-05 12:03:12 +01:00
Benjamin Dauvergne 5192cdf7a0 [core] multiple decryption keys support
This commit complements the support for multiple signing certificate
support in the metadata files. The use-case is still key roll-over.

The structure LassoServerPrivateData was changed to accomodate multiple
decryption keys, and so:

 xmlSecKey *encryption_private_key

became:

 GList *encryption_private_keys

All uses of this key were replaced by a loop over this list, terminating
with the first key to be able to decrypt the content.

The private key passed to lasso_server_new() or
lasso_server_new_from_buffers() is first added to the list of decryption
keys. Any other call to
lasso_server_set_encryption_private_key_with_password() or
lasso_server_set_encryption_private_key() will add a new key to the
list.
2011-11-21 10:25:03 +01:00
Benjamin Dauvergne 9cedec628e [core] finish transition from single encryption key to multiple ones
Some code still reference provider->private->encryption_public_key, this
commit make them use lasso_provider_get_encryption_public_key().
2011-05-30 22:24:37 +02:00
Benjamin Dauvergne e67f2bb658 [core] first try at multiple signing keys support
The idea was to replace every use of an xmlSecKey* by a loop over a
GList* of xmlSecKey*.

 - In the structure LassoProviderPrivate changed
    xmlSecKey*public_key            ->   GList* signing_public_keys
    xmlNode*signing_key_descriptor  ->   GList* signing_key_descriptors.
 - Renamed lasso_provider_try_loading_public_key to
   lasso_provider_try_loading_public_keys and chaned its signature
   accordingly
 - Renamed lasso_provider_get_public_key to
   lasso_provider_get_public_keys and changed the signature accordingly.
 - Changed lasso_provider_get_encryption_public_key to return the first
   signing key from the list as a temporary work around. Multiple
   encryption keys will be supported later.
 - Changed lasso_provider_load_public_key to load keys from the passed
   file on the LassoProvider constructor, from every key descriptors
   found for signing and eventually from the key descriptor marked for
   encryption.
 - Every failure to load from a file or an XML KeyInfo descriptor are
   noew reported as warning.
 - Query signature checking was completely moved to
   lasso_provider_verify_query_signature and
   lasso_provider_verify_signature now calls it.
 - lasso_provider_verify_signature is now using lasso_verify_signature
   from the xml/tools.o module.
 - lasso_provider_verify_single_signature was modified to support
   multiple signing keys.
2011-05-19 17:54:16 +02:00
Benjamin Dauvergne e14652e7a4 [utils] add macros to append to and release a list of xmlSecKey*
[core] make lasso_provider_verify_query_signature use lasso_provider_verify_signature
2011-05-19 17:54:16 +02:00
Benjamin Dauvergne f840037c6a [core] add a private constructor to build LassoProvider object from an xmlNode
I'm not sure of the need outside lasso so I will let this method private
for the moment. It's an helper method for the
lasso_server_load_federation method which traverses an
EntitiesDescriptor node to find all the EntityDescriptor contained
inside.
2011-03-29 18:43:48 +02:00
Benjamin Dauvergne 4ebb7067a0 [core] check type of first argument of lasso_provider_get_assertion_consumer_url 2010-10-09 15:51:23 +02:00
Benjamin Dauvergne 6b2a21d116 [core] adapt lasso_provider_get_assertion_consumer_service_url for SAMLv2 2010-10-07 18:38:21 +02:00
Benjamin Dauvergne 462c9a1cd0 [Core] replace all use of g_strcmp0 by lasso_strisequal and lasso_strisnotequal
Too much human errors with strcmp kind of functions. Also change name os
lasso_is_empty_string to lasso_strisempty.
2010-10-01 15:29:38 +02:00
Benjamin Dauvergne 667f846085 [Core] fix leak of provider->private_data->endpoints 2010-09-17 17:02:41 +02:00
Benjamin Dauvergne 69f46ad974 [Core] fix leak of provider->private_data->endpoints 2010-09-17 17:02:40 +02:00
Benjamin Dauvergne 3f336a8e83 Merge branch 'develop' into hotfixes-2.3.1 2010-09-03 19:07:08 +02:00
Benjamin Dauvergne 9ab6b944f1 [Core] fix memory leak in lasso_endpoint_free 2010-09-03 19:05:27 +02:00
Benjamin Dauvergne aaca9ce992 [ID-FFv1.2&SAMLv2] add more warning for failure to load metadata file
Report detailf of the failure through warning log.
2010-09-03 19:02:42 +02:00
Benjamin Dauvergne 5c85507ffd [Core] add destroy code for new private field endpoints
The contained string must be disallocated if the object is destroyed.
2010-08-25 18:55:04 +02:00
Benjamin Dauvergne 7352ec8036 [Provider] Fix loading of provider without a public key
This commit also emit propre warning when loading fails for a provider
*with* a public key.
2010-07-05 21:27:08 +00:00
Benjamin Dauvergne 129e7ac6ea Merge branch 'issue-101' 2010-06-29 09:15:06 +00:00
Benjamin Dauvergne 4a55c53ee6 SAMLv2: fix error in naming of function in the documentation 2010-06-04 09:32:48 +00:00
Benjamin Dauvergne dc0da3d1b0 Provider: fix problem when reusing the same lists nodes in Descriptors 2010-04-22 01:12:32 +00:00
Benjamin Dauvergne 0e8441afe3 Improve safety by replacing all g_hash_table_destroy use by lasso_release_ghashtable 2010-04-22 00:45:02 +00:00
Benjamin Dauvergne 2f5ef5fef0 Improve safety by replacing all g_list_free use by lasso_release_list 2010-04-22 00:44:57 +00:00
Benjamin Dauvergne 0a169eda51 Improve safety by replacing all g_free use by lasso_release 2010-04-22 00:44:45 +00:00
Benjamin Dauvergne 05aad98ec3 Fix documentation problems 2010-04-19 11:30:35 +00:00
Benjamin Dauvergne 143e775942 ID-FF 1.2 & SAML 2.0: factorize access to role prefix 2010-04-06 13:11:36 +00:00
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