Commit Graph

74 Commits

Author SHA1 Message Date
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 4c3af26a58 [SAMLv2] also initialize Destination for response messages
asynchronous bindings needs Destination attribute even for response
messages.
2010-09-30 10:58:50 +02:00
Benjamin Dauvergne 6eeebd0304 [SAMLv2] in profile.c fix uncovered enumeration value in switch 2010-09-17 17:02:40 +02:00
Benjamin Dauvergne 51d5d4d3e3 [SAMLv2] apply the LassoProfileVerifySignatureHint when processing requests
The check was missing for processing of logout requests, name id
management request and assertion query responses.

A new internal function lasso_saml20_profile_check_signature_status is
added.
2010-09-09 16:20:17 +02:00
Benjamin Dauvergne b1f6b7e0ed [SAMLv2] when no artifact message is present, still return a success status
It is mandated by the specification.
2010-09-07 10:34:34 +02:00
Benjamin Dauvergne f245907b8c [SAMLv2] when failing to recreate the content for the ArtefactResponse set a lasso specific status code 2010-09-03 19:02:42 +02:00
Benjamin Dauvergne 4178cbef13 [SAMLv2] change the way content is stored and loaded for the HTTP-Artifact binding
Previously content was stored as the result of lasso_node_dump method
then reloaded, and then serialized again as part of the ArtifactResponse
message. lasso_node_dump was ignoring all hint to sign node, but keeping
the needed parameters around. That's not what must be done, the
signature should happen at the generation of the artifact and the result
must manipulated as is (i.e. XML content) and never moved back to the
land of LassoNode objects.

Now the content is:
- first removed of any signature at the message level, because the
  ArtifactResponse will take care of this, (any signature under this
  level (like at the assertion) is kept),
- serialized using lasso_node_export_to_xml,
- reloaded using lasso_xml_parse_memory,
- and put into the ArtifactResponse using a
  lasso_misc_text_node_new_with_xml_node.
2010-09-03 19:02:42 +02:00
Benjamin Dauvergne edd618319c [SAMLv2] make lasso_saml20_profile_generate_artifact a static function
It is only used in lasso/saml-2.0/profile.c anyway.
2010-09-03 19:02:42 +02:00
Benjamin Dauvergne e869899b79 [SAMLv2] add support for encrypted private keys
* support private key with new internal API in signature setting
   methods

Plug lasso_node_set_signature into
lasso_profile_saml20_setup_message_signature and
lasso_server_saml2_assertion_setup_signature.

 * also use lasso_node_get_signature in has_signature

 * add forgottent LASSO_PROFILE_SIGNATURE_VERIFY_HINT_FORCE in switch
   cases

For AuthnResponse checking the semantic is now that if HINT_FORCE is
used we verify message signature *and* assertion signature. If
HINT_MAYBE is used we check the assertion signature if its issuer
differs from the message issuer.
2010-07-16 19:34:30 +00:00
Benjamin Dauvergne c939427f21 [Core] add a password parameter to lasso_query_sign
We force use of the password through a custom OpenSSL password callback.
2010-07-16 19:34:21 +00:00
Benjamin Dauvergne c1a4ba2fc0 Merge branch 'issue-88' 2010-06-29 09:15:02 +00:00
Benjamin Dauvergne a041a2ef81 Initialize all uninitialized rc variables 2010-04-30 09:23:01 +00:00
Benjamin Dauvergne 86e549141f SAML 2.0: lasso_saml20_profile_process_any_response_msg, change status code checking 2010-04-27 22:55:21 +00:00
Benjamin Dauvergne 38d3f9d9a4 SAML 2.0 Profile: remove unused must_sign variable 2010-04-22 00:44:11 +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 21015341e4 SAML 2.0: add Destination attribute to requests
* lasso/saml-2.0/profile.c:
   this change make Lasso respect paragraphs 3.4.5.2 (HTTP-Redirect
   binding securit considerations ) and 3.5.5.2 (the same for HTTP-Post)
   of the saml-bindings-2.0-os.pdf document, and should allow our Authn
   Requests to be accepted by shiboleth IdP.
2010-04-06 15:00:46 +00:00
Benjamin Dauvergne ed77956b86 Fix return path in lasso_saml20_process_any_response for signatures checking 2010-04-06 13:10:58 +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 97f37266e3 Support SignatureVerifyHint in SAML 2.0 SSO profile and common message handling 2010-03-27 16:51:38 +00:00
Benjamin Dauvergne 7d950e7457 SAML 2.0: change error code for empty ArtifactResolve response to LASSO_PROFILE_ERROR_MISSING_RESPONSE 2010-03-02 11:57:57 +00:00
Benjamin Dauvergne d393251585 SAML 2.0: in lasso_saml20_profile_set_session_from_dump_decrypt, really decrypt
* lasso/saml-2.0/profile.c:
   dump for already signed assertion containing an EncryptedID as
   Subject does not work as before, the decrypted NameID is no more
   included in it, so instead of trying to plug it in the NameID field
   we resort to really deciphering the EncryptedID.
   That could be a performance problem if the session object is stuffed
   with a lot of assertions.
2010-02-17 10:15:21 +00:00
Benjamin Dauvergne ee77424f54 SAML 2.0: in lasso_saml20_profile_process_any_response do not stop on missing issuer
* lasso/saml-2.0/profile.c:
   Issuer is not a mandatory element of SAML 2.0 response,
   but if we do not remember which issuer we sent the request (of if
   the response is spontaneous) then we will receive a provider not found
   error when trying to check the message signature.
2010-02-10 00:34:35 +00:00
Benjamin Dauvergne 8c26e2ba8c Use new SAML2 strings instead of hardcoding query string field names 2010-02-10 00:34:29 +00:00
Benjamin Dauvergne 92efc271a4 SAML 2.0: fix annotations, documentation and signatures 2010-01-29 00:43:50 +00:00
Benjamin Dauvergne 0279087029 Documentation: distribute stylesheet, fix documentation comments, compelte lasso-sections.txt 2010-01-18 10:03:54 +00:00
Benjamin Dauvergne 9d544c49d0 SAML 2.0: report missing request when creating artifact resolve response, fix typo in lasso_saml20_profile_build_post_response_msg 2010-01-14 16:18:28 +00:00
Benjamin Dauvergne 63206b32f2 in saml-2.0/profile.c, in lasso_saml20_build_response_msg, when no url is given, only stop for bindings needing one 2010-01-12 15:40:12 +00:00
Benjamin Dauvergne 39eba085a5 in saml-2.0/profile.c, in lasso_saml20_profile_init_response make direct access 2010-01-12 15:40:11 +00:00
Benjamin Dauvergne 926bfeee2c in saml-2.0/profile.c, in lasso_saml20_init_request better check for supported bindings, do not check for identity or session, report SESSION_NOT_FOUND only if first_in_session is used, do not stop on missing name_id. 2010-01-12 15:40:09 +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 1eb34af43f Core: in profile.c, make lasso_profile_get_nameIdentifier work for transient federations
* lasso/id-ff/profile.c:
   if no LassoIdentity is accessible try to get a name identifier
   through the assertion in the LassoSession object. This allows the
   logout profile to work without an identity object (which is normal
   since logout does not modify the federation status).
2010-01-12 15:39:35 +00:00
Benjamin Dauvergne 4fe35b69cc SAML 2.0: add new function to factorize adding signature to a message 2010-01-12 15:39:33 +00:00
Benjamin Dauvergne d067792e7f in lasso_saml20_profile_export_to_query, checks return values
* lasso/saml-2.0/profile.c:
   in lasso_saml20_profile_export_to_query, check return value of of
   lasso_node_build_query and lasso_query_sign.
2009-12-04 09:05:28 +00:00
Benjamin Dauvergne 2ed0af41c2 Remove message level signature on redirect messages
* lasso/saml-2.0/profile.c:
   remove message level signatures before building query strings.
2009-11-30 15:16:04 +00:00
Benjamin Dauvergne 266e10bb73 Add more check to remove_signature
* lasso/saml-2.0/profile.c:
   check for NULL when accessing klass datas.
2009-11-30 15:16:03 +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 5b0f7953b6 SAML2: use the static get_provider helper method in generic profile methods
* lasso/saml-2.0/profile.c:
   instead of accessing directly profile->server use the helper method
   get_provider.
2009-10-30 14:47:25 +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 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 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 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 4ba02b0725 lasso_saml20_profile_init_artifact_resolve(): check http_method
* lasso/saml-2.0/profile.c:
   check the given http_method it must one in
   - LASSO_HTTP_METHOD_ARTIFACT_POST,
   - LASSO_HTTP_METHOD_ARTIFACT_GET.
2009-04-27 08:19:24 +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 280f5d0c72 SAML 2.0: Update generic relaystate handling
* lasso/saml-2.0/profile.c:
   in lasso_saml20_profile_build_redirect_request_msg and
   lasso_saml20_profile_build_redirect_response, use new function
   lasso_saml20_profile_build_http_redirect.
2009-03-27 15:06:44 +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 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 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