Commit Graph

154 Commits

Author SHA1 Message Date
Benjamin Dauvergne c1a4ba2fc0 Merge branch 'issue-88' 2010-06-29 09:15:02 +00:00
Benjamin Dauvergne 2c0ea4d647 Change all logging to use message() 2010-06-09 16:54:55 +00:00
Benjamin Dauvergne 9d22f29e55 SAML 2.0: in lasso_login_build_assertion set conditions time limit, no SubjectConfirmationData limits 2010-05-31 07:13:41 +00:00
Benjamin Dauvergne 60c6a25208 SAML 2.0: in lasso_login_build_assertion do not conflate sessionNotOnOrAfter with assertion condition notOnOrAfter 2010-05-31 07:13:39 +00:00
Benjamin Dauvergne 23c604b268 SAMLv2: conflate Responder and Requester when checking second level status code
* lasso/saml-2.0/login.c:
   I'm not sure that most IdP really make the semantic distinction
   between those two first level status codes, so just conflate them.
2010-05-11 08:54:47 +00:00
Benjamin Dauvergne c2fff8b5f1 SAMLv2: remove warning message for invalid signature on AuthnResponse messages
* lasso/saml-2.0/login.c:
   we already return an error, no need to clutter the output with
   warning messages.
2010-05-11 08:54:45 +00:00
Benjamin Dauvergne a041a2ef81 Initialize all uninitialized rc variables 2010-04-30 09:23:01 +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 11a8f53846 SAML 2.0: in lasso_saml20_process_federation, only handle the case of PERSISTENT format
* lasso/saml-2.0/login.c:
   in lasso_saml20_process_federation:
   - if no name id format can be found by the request, use the default from
     the metadata file (first declared NameIDFormat)
   - instead of checking if format is TRANSIENT, check if it is PERSISTENT,
     and proceed with the federation, if not just return 0.
   - return LASSO_PROFILE_ERROR_UNKNOWN_PROVIDER instead of
     LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND.
   - in any case, check for consent.
2010-04-20 09:34:23 +00:00
Benjamin Dauvergne 281817ce87 SAML 2.0: in lasso_saml20_login_validate_request, do not check signature if not necessary 2010-04-20 09:34:22 +00:00
Benjamin Dauvergne dd495ca6c3 SAML 2.0: find binding when only AssertionConsumerServiceURL is set, do not check signature on request if asked 2010-04-20 09:34:20 +00:00
Benjamin Dauvergne 6ff6f92720 Login: add internal function _lasso_login_must_verify_*signature 2010-04-20 09:34:17 +00:00
Benjamin Dauvergne 81c35bbe2e Ameliorate support for lasso_profile_set_signature_verify_hint
* lasso/id-ff/profile.h:
   - add end symbol for enum LassoProfileSignatureVerifyHint
 * lasso/id-ff/profile.c:
   - fix documentation of lasso_profile_set_signature_verify_hint
   - do not allow to set or return invalid value for the
     signature_verify_hint attribute.
 * lasso/saml-2.0/login.c:
   - handle new enum value
 * lasso/saml-2.0/profile.c:
   - handle new enum value
   - fix missing catch of signature error reporting when
     signature_verify_hint is IGNORE.
 * docs/reference/lasso/lasso-sections.txt:
   - export enums LassoProfileSignatureHint and
     LassoProfileSignatureVerifyHint
 * tests/metadata_tests.c:
   - fix test of all Role enumerations
2010-04-16 15:37:17 +00:00
Benjamin Dauvergne 97f37266e3 Support SignatureVerifyHint in SAML 2.0 SSO profile and common message handling 2010-03-27 16:51:38 +00:00
Benjamin Dauvergne 139a31df80 SAML 2.0: fix uninitialized variable 2010-03-08 13:19:59 +00:00
Benjamin Dauvergne a93d3e5f5c SAML 2.0: separate lasso_saml20_login_process_response_status_and_assertion into multiple functions
* lasso/saml-2.0/login.c:
   in lasso_saml20_login_process_response_status_and_assertion, extract assertion
   decryption, and issuer checking into their own function.
2010-02-10 00:34:59 +00:00
Benjamin Dauvergne b758c1c58c SAML 2.0: in lasso_saml20_login_process_authn_response_msg always report signatures errors
* lasso/saml-2.0/login.c:
   - in lasso_saml20_login_process_authn_response_msg keep around all error
     codes returned by intermediary steps. At the end report the first one.
2010-02-10 00:34:39 +00:00
Benjamin Dauvergne b780bd2376 Fix leaks
* lasso/id-wsf-2.0/profile.c: release private data object.
 * lasso/saml-2.0/login.c: free NameID content after construction.
 * lasso/xml/tools.c: free algorithm attribute content in
   lasso_node_decrypt_xmlnode.
 * lasso/xml/xml.c: release cutom_element->nodename in destructor.
   remove useless finalize method.
 * tests/basic_tests.c: release xmldoc after use.
 * tests/random_tests.c: free resut of lasso_node_dump.
2010-02-04 00:02:07 +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 92efc271a4 SAML 2.0: fix annotations, documentation and signatures 2010-01-29 00:43:50 +00:00
Benjamin Dauvergne 869768bc35 SAML 2.0: Fix typo in lasso_saml20_login_build_authn_response_msg 2010-01-14 16:18:26 +00:00
Benjamin Dauvergne 59f8ae0944 in lasso_saml20_login_init_idp_initiated_auhtn_request, do not use init_authn_request, manually create the request. 2010-01-12 15:40:15 +00:00
Benjamin Dauvergne 76ae81022c in lasso_saml20_login_init_authn_request, use saml-2.0/profile.c functions to reduce code size 2010-01-12 15:40:14 +00:00
Benjamin Dauvergne d42c16e239 Core Node: add args to lasso_node_encrypt to set recipient of an encrypted element 2010-01-12 15:39:57 +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 56bd9e2405 Fix mitm attack using the AssertionConsumerURL property on requests
* lasso/saml-2.0/login.c: check that the URL is know before using it
 * lasso/saml-2.0/provider.c lasso/saml-2.0/providerprivate.h:
   add a function to check that an URL corresponds to a know
   AssertionConsumer of the given provider.
2010-01-12 15:39:31 +00:00
Benjamin Dauvergne 2725070917 SAML 2.0: in login.c, use lasso_server_saml2_assertion_setup_signature 2010-01-04 09:14:31 +00:00
Benjamin Dauvergne 689aa794b7 SAML 2.0: in login.c, fix memleaks
* lasso/saml-2.0/login.c:
   return value from lasso_provider_get_sp_name_qualifier must be freed.
2010-01-04 09:14:24 +00:00
Benjamin Dauvergne 8246e5d438 SAML 2.0: in login.c, remove discovery bootstrap handling 2010-01-04 09:14:22 +00:00
Benjamin Dauvergne b6c9be9fa2 Core Login: in login.c, add assertion accessor
* docs/reference/lasso/lasso-sections.txt:
   declare new function
 * lasso/id-ff/login.c lasso/id-ff/login.h:
   add new function lasso_login_get_assertion.
 * lasso/saml-2.0/login.c:
   store created assertions
 * lasso/id-ff/login.h:
   make assertion field private for bindings.
2010-01-04 09:14:20 +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 2b24cd50e2 SAML2: change lasso_saml20_profile_set_response_status signature
* lasso/saml-2.0/profile.c:
 * lasso/saml-2.0/profileprivate.h:
   make lasso_saml20_profile_set_response_status2 the new implementation
   of lasso_saml20_profile_set_response_status.
   add helper macros to set success, responder and requester first level
   status code.
 * saml-2.0/assertion_query.c:
 * saml-2.0/login.c:
 * saml-2.0/logout.c:
 * saml-2.0/name_id_management.c:
   adapt consumers to the new signature.
2009-10-30 14:47:30 +00:00
Benjamin Dauvergne 6921dd1d9b ID-FF1.2 and SAML2: remove direct access to profile->server->providers
* client of LassoServer should use lasso_server_get_provider.
 * LASSO_PROFILE_ERRROR_UNKNOWN_PROVIDER was a mistake, it is
   superfluous, use LASSO_SERVER_ERROR_PROVIDER_NOT_FOUND.
2009-10-30 14:47:23 +00:00
Benjamin Dauvergne 17d6885dfc Change setting of default NameIDFormat for SAML 2.0 login
* saml-2.0/login.c:
   in lasso_saml20_login_init_authn_request,
   lasso_saml20_login_init_idp_initiated_authn_request, if the service
   provider provided a list of supported name id formats, use the first
   one as default for new AuthnRequest.
 * id-ff/login.c:
   modify documentation to report the new way of choosing a default.
2009-09-29 13:20:33 +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 29de608d19 SAML 2.0: Fix bug introduced in commit 4235
* lasso/saml-2.0/login.c:
   profile->msg_url is released before being used ;( Restore the code
   copying the URL before passing it to
   lasso_saml20_profile_build_http_redirect, to free it after.
2009-08-26 15:15:24 +00:00
Benjamin Dauvergne fd256b2269 Docs: change the doc production and lot of other fixes
* lasso/Makefile.am:
   distribute extract_sections.py
 * docs/references/lasso/lasso.types.in: add missing class (mainly SAML2
   and ID-WSF 1.0/2.0) from docs/references/lasso.types.in

 * lasso/xml/strings.h:
   add lots of documentation, or at least documentation template to
   strings constants.
 * id-ff/login.h:
 * saml-2.0/assertion_query.h:
 * xml/xml.h:
   document undocumented enumerations.
 * lasso/errors.h:
   add proper documentation about error codes.
 * lasso/errors.c:
   new version of the lasso_strerror function
 * lasso/build_strerror.py:
   update the script that generater lasso_strerror from the
   documentation comments.

   Remove usage of OFTYPE

 * lasso/id-ff/session.c:
 * lasso/id-ff/session.h:
   remove usage of oftype, prefer gtk-introspection annotations instead.
 * lasso/id-wsf/data_service.h:
 * lasso/id-wsf/data_service.c:
   do the same.

   Add a script to build lasso-sections.txt

 * lasso/extract_sections.py:
   this script parses header files and generated lasso-sections.txt
   content for GObject class descriptions.

   Add a template file for the lasso-section.txt file

 * docs/references/lasso-sections.txt.in:
   this file serves as a base for the generation of lasso-sections.txt

   Update docs/references/Makefile.am for generating lasso-sections.txt

 * docs/references/Makefile.am:
   always rebuild template, using out of source build directory is too
   weird without it.
   call new script extract_sections.py to regenerate lasso-sections.txt
   if header files changed.

   Update lasso.sgml file with all missing sections

 * docs/reference/lasso.sgml:
   add all missing sections, mainly objects from XML schemas.

 * docs/reference/lasso-sections.txt: update it

 * *.c: add section documentation to some files.
 * lasso/xml/strings.h: fix bad usage or docbook markup
2009-08-26 15:15:07 +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 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 c5f5f84329 SAML 2.0: Fix many leaks
* lasso/saml-2.0/login.c:
 * lasso/saml-2.0/logout.c:
 * lasso/saml-2.0/name_id_management.c:
 * lasso/saml-2.0/profile.c:
 * lasso/saml-2.0/provider.c:
   do not mix g_malloc strings with libxml strings, use the
   string/gobject handling macros as much as possible, be a good memory
   citizen, don't put your elbows on the table.
2009-04-30 14:58:11 +00:00
Benjamin Dauvergne 2a75e87543 More work on signature validation for SAML 2.0
* lasso/saml-2.0/profile.c:
   in lasso_saml20_profile_process_any_request and
   lasso_saml20_profile_process_any_response do not make signature
   validation failure as call failure, just store the result in
   profile->signature_status and let the upper level functions handle
   what to do with it. also add documentation about those two functions.

 * lasso/saml-2.0/logout.c:
 * lasso/saml-2.0/name_id_management.c:
   handle new signature_status semantic.

 * lasso/saml-2.0/login.c:
   add internal documentation for
   lasso_saml20_login_process_authn_response_msg.
2009-04-27 15:48:53 +00:00
Benjamin Dauvergne cbd9ade936 Update signature_status when checking signature on assertions
* lasso/saml-2.0/login.c:
   if signature_status is SIGNATURE_NOT_FOUND, check one on the
   assertion and keep the result in signature_status.
2009-04-27 14:31:51 +00:00
Benjamin Dauvergne b2c9e44a05 FIX: verify assertion signature for SAML 2.0 when response is not signed
* lasso/saml-2.0/login.c:
   if response was not signed, check the signature on the assertion.
2009-04-27 08:19:37 +00:00
Benjamin Dauvergne bb7af761c5 new function lasso_saml20_login_check_assertion_signature()
* lasso/saml-2.0/login.c:
   lasso_saml20_login_check_assertion_signature() find the issuer of an
   assertion, look it up in the server object and try to validate its
   signature. It returns an error code if any of this step fails.
2009-04-27 08:19:35 +00:00
Benjamin Dauvergne 8fe7780441 SAML 2.0: Use new API lasso_url_add_parameter
* lasso/saml-2.0/profile.c:
   use new API lasso_url_add_parameter to handle RelayState parameter
   creation.
2009-04-22 23:49:24 +00:00
Benjamin Dauvergne b538c31bd3 SAML 2.0: Check http_method in build_artifact_msg
* lasso/saml-2.0/login.c:
   if http_method is not among ARTIFACT_GET and ARTIFACT_POST, return an
   INVALID_HTTP_METHOD error.
2009-04-22 23:49:22 +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 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