Commit Graph

181 Commits

Author SHA1 Message Date
Benjamin Dauvergne b6faccae0f fix warnings about unused but set variables 2013-09-08 21:31:52 +02:00
Benjamin Dauvergne ee4058bc22 [saml 2.0] use the new SessionIndex storage for SLO management
It shoulf fix any missing functionnalities regarding missing session indexes
in logout requests sent by identity providers or service providers.
2011-12-22 18:16:46 +01:00
Benjamin Dauvergne 727f07b1ae Simplify useless complexity in include paths 2011-12-16 14:17:31 +01:00
Benjamin Dauvergne fd7af65e91 [core] do not emit a warning for expected decryption errors
The only expected decryption error is on decryption of the symetric key
used to crypt the data. All other errors are critical and must be
logged.

Client of lasso_node_decrypt_xmlnode can then log the decryption failure
of the symetric if they tried with all possible keys (key rollover
case).
2011-11-22 18:51:49 +01:00
Benjamin Dauvergne 26d6b35a49 [leakcheck] fix leaks seen by the unit tests
This commit also improved valgrind suppression file to hide static
allocations done by the GLib type system.
2011-11-22 17:45:52 +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 481aeef4e0 [saml2] if Status is not Success pass continue processing the response
lasso_saml20_login_process_response_status_and_assertion does analyze
the response status code login specific error codes, if the generic
processing from lasso_saml20_profile_process_any_response returns a
status of response is not success, we must continue processing.
2011-04-21 11:23:10 +02:00
Benjamin Dauvergne aa9898693a [saml login] suppress unused argument warning 2010-12-21 10:44:14 +01:00
Benjamin Dauvergne fd52e68094 [samlv2 login] do not setup conditions->notBefore/notOnOrAfter only notOnOrAfter on SubjectConfirmationData 2010-12-17 17:34:59 +01:00
Benjamin Dauvergne 355df68dfe [saml2] use new encryption structure instead for internal field in LassoSaml2Assertion 2010-12-14 01:57:09 +01:00
Benjamin Dauvergne f7dbcbb2b4 [saml2] do not set SPNameQualifier it should be reserved for SP member of an affiliation 2010-12-13 16:20:29 +01:00
Benjamin Dauvergne 7a27400a87 [SAMLv2] adopt same behaviour as ID-FFv1.2 for invalid AuthnRequest 2010-10-06 17:00:52 +02:00
Benjamin Dauvergne 86f0f6b6f2 [SAMLv2] restore setting of SubjectConfirmationData->NotOnOrAfter
This was wrongly removed by me in commit
9d22f29e55.

This is the responsability of the caller to adjust value on the
Conditions and SubjectConfirmationData independently after.
2010-10-01 17:44:40 +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 fe63f7a517 [SAMLv2] add missing compare to 0 introduced in 7386dc8189
I hate strcmp.
2010-10-01 12:22:17 +02:00
Benjamin Dauvergne 7386dc8189 [SAMLv2] when NidPolicy->Format is NULL or unspecified, return transient
Add more default cases.
2010-09-30 10:58:18 +02:00
Benjamin Dauvergne 5bcbb0e55f [SAMLv2] fix early release of the request when using idp_initiaed login 2010-09-17 18:07:39 +02:00
Benjamin Dauvergne 19aad7629a [SAMLv2] fix memleak of request in lasso_saml20_login_process_authn_request_msg 2010-09-17 17:02:41 +02:00
Benjamin Dauvergne 8b0de80e4c [SAMLv2] fix mem leaks 2010-09-17 17:02:35 +02:00
Benjamin Dauvergne 88236da2d2 [SAMLv2] mark Redirect binding as an invalid binding for return AuthnResponse
This is really not supported by the SAMLv2 protocol.
2010-08-25 19:02:22 +02:00
Benjamin Dauvergne 3769decc58 [SAMLv2] fix string in comment 2010-08-25 19:02:01 +02:00
Benjamin Dauvergne 2ab81b8e6f [SAMLv2] replace use of lasso_provider_get_default_name_id_format with direct use of lasso_provider_get_metadata_one_for_role
The first is trying to use provider->role to know which kind of role
descriptor to lookup, but for the server object this field is 0 and when
building authn request we know that we want our default NameIDFormat for
the SP sso descriptor.
2010-08-25 19:00:36 +02:00
Benjamin Dauvergne fc9c2738c6 [SAMLv2] when AuthnRequest contains invalid attributes returns INVALID_REQUEST not NO_DEFAULT_ENDPOINT
This is the right status to return.
2010-08-25 15:41:55 +02:00
Benjamin Dauvergne aebd6ed3d7 [SAMLv2] simplify logic for handling AuthnResponse with binding HTTP-Post
The logic is now simpler:
 - first lasso_saml20_profile_process_any_response check the signature
   on the message
 - then lasso_saml20_login_process_response_status_and_assertion
   traverse all the assertions:
   - if the message is signed all assertion from the same issuer are
     automatically accepted,
   - if the message is not signed, or the signature validation failed,
     or the assertion has a different issuer than the message, we check
     the signature directly on the assertion. If any of the assertions
     fails the signature check, the result will be
     LASSO_PROFILE_ERROR_CANNOT_VERIFY_SIGNATURE.

The public field profile->signature_status will contain only the message
level signature status, each assertion signature status is not
accessible. That will change when signature and key handling is
reworked.
2010-07-20 14:15:55 +00:00
Benjamin Dauvergne e79fcf3beb [SAMLv2/SSO] when processing AuthnResponse with binding HTTP-Post only the assertion need to be signed
If the message is signed, the assertion is also covered, but if only the
assertion is signed, there is no error to report. If the caller ask for
forcing the validation of message signature, then we report an error.

This commit also add checking for the binding used, if it is not
HTTP-Post lasso_login_process_authn_response_msg will now report an
error.
2010-07-19 15:27:10 +00: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 98445777b9 [SAMLv2] if service provider supports logout, add a SessionIndex from the assertion ID
The standard mandate to provide a SessionIndex to service provider
advertaising their support of the logout profile. We follow the
convention of using the assertion ID as a SessionIndex.
2010-07-12 14:09:14 +00:00
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