diff options
author | Valery Febvre <vfebvre at easter-eggs.com> | 2004-08-19 18:48:53 +0000 |
---|---|---|
committer | Valery Febvre <vfebvre at easter-eggs.com> | 2004-08-19 18:48:53 +0000 |
commit | 33833bc3bbfbae8d7a7436f7b13609efa1da6af8 (patch) | |
tree | f6382ddc0bbb24089fe996bb2e36eb59c2a1fe52 /lasso/Attic | |
parent | c058f4dde9e58c0a622b6d50b920830e27960a73 (diff) | |
download | lasso-33833bc3bbfbae8d7a7436f7b13609efa1da6af8.tar.gz lasso-33833bc3bbfbae8d7a7436f7b13609efa1da6af8.tar.xz lasso-33833bc3bbfbae8d7a7436f7b13609efa1da6af8.zip |
Fixed a mistake with name identifiers of the assertions
Diffstat (limited to 'lasso/Attic')
-rw-r--r-- | lasso/Attic/protocols/elements/authentication_statement.c | 60 | ||||
-rw-r--r-- | lasso/Attic/protocols/elements/authentication_statement.h | 2 |
2 files changed, 27 insertions, 35 deletions
diff --git a/lasso/Attic/protocols/elements/authentication_statement.c b/lasso/Attic/protocols/elements/authentication_statement.c index 110e8f6f..32d16e87 100644 --- a/lasso/Attic/protocols/elements/authentication_statement.c +++ b/lasso/Attic/protocols/elements/authentication_statement.c @@ -69,7 +69,7 @@ GType lasso_authentication_statement_get_type() { LassoNode* lasso_authentication_statement_new(const xmlChar *authenticationMethod, const xmlChar *reauthenticateOnOrAfter, - LassoSamlNameIdentifier *identifier, + LassoSamlNameIdentifier *sp_identifier, LassoSamlNameIdentifier *idp_identifier) { LassoNode *statement; @@ -78,12 +78,8 @@ lasso_authentication_statement_new(const xmlChar *authenticationMethod gchar *str; xmlChar *time; - if (identifier != NULL) { - g_return_val_if_fail(LASSO_IS_SAML_NAME_IDENTIFIER(identifier), NULL); - } g_return_val_if_fail(LASSO_IS_SAML_NAME_IDENTIFIER(idp_identifier), NULL); - statement = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHENTICATION_STATEMENT, NULL)); lasso_saml_authentication_statement_set_authenticationMethod(LASSO_SAML_AUTHENTICATION_STATEMENT(statement), @@ -96,46 +92,42 @@ lasso_authentication_statement_new(const xmlChar *authenticationMethod reauthenticateOnOrAfter); subject = lasso_lib_subject_new(); - if (identifier == NULL) { - /* create a new NameIdentifier and use idp_identifier data to fill it */ - str = lasso_node_get_content(LASSO_NODE(idp_identifier), NULL); - new_identifier = lasso_saml_name_identifier_new(str); - xmlFree(str); - str = lasso_node_get_attr_value(LASSO_NODE(idp_identifier), "NameQualifier", NULL); - if (str != NULL) { - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(new_identifier), str); - xmlFree(str); + if (sp_identifier == NULL) { + if (idp_identifier != NULL) { + new_identifier = lasso_node_copy(LASSO_NODE(idp_identifier)); } - str = lasso_node_get_attr_value(LASSO_NODE(idp_identifier), "Format", NULL); - if (str != NULL) { - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(new_identifier), str); - xmlFree(str); + else { + message(G_LOG_LEVEL_CRITICAL, "Failed to create the authentication statement, both name identifiers are NULL\n"); + lasso_node_destroy(statement); + return (NULL); } } else { - new_identifier = lasso_node_copy(LASSO_NODE(identifier)); + new_identifier = lasso_node_copy(LASSO_NODE(sp_identifier)); } lasso_saml_subject_set_nameIdentifier(LASSO_SAML_SUBJECT(subject), LASSO_SAML_NAME_IDENTIFIER(new_identifier)); lasso_node_destroy(new_identifier); - /* create a new IdpProvidedNameIdentifier and use idp_identifier data to fill it */ - str = lasso_node_get_content(LASSO_NODE(idp_identifier), NULL); - new_idp_identifier = lasso_lib_idp_provided_name_identifier_new(str); - xmlFree(str); - str = lasso_node_get_attr_value(LASSO_NODE(idp_identifier), "NameQualifier", NULL); - if (str != NULL) { - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(new_idp_identifier), str); - xmlFree(str); - } - str = lasso_node_get_attr_value(LASSO_NODE(idp_identifier), "Format", NULL); - if (str != NULL) { - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(new_idp_identifier), str); + if (sp_identifier != NULL) { + /* create a new IdpProvidedNameIdentifier and use idp_identifier data to fill it */ + str = lasso_node_get_content(LASSO_NODE(idp_identifier), NULL); + new_idp_identifier = lasso_lib_idp_provided_name_identifier_new(str); xmlFree(str); + str = lasso_node_get_attr_value(LASSO_NODE(idp_identifier), "NameQualifier", NULL); + if (str != NULL) { + lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(new_idp_identifier), str); + xmlFree(str); + } + str = lasso_node_get_attr_value(LASSO_NODE(idp_identifier), "Format", NULL); + if (str != NULL) { + lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(new_idp_identifier), str); + xmlFree(str); + } + lasso_lib_subject_set_idpProvidedNameIdentifier(LASSO_LIB_SUBJECT(subject), + LASSO_LIB_IDP_PROVIDED_NAME_IDENTIFIER(new_idp_identifier)); + lasso_node_destroy(new_idp_identifier); } - lasso_lib_subject_set_idpProvidedNameIdentifier(LASSO_LIB_SUBJECT(subject), - LASSO_LIB_IDP_PROVIDED_NAME_IDENTIFIER(new_idp_identifier)); - lasso_node_destroy(new_idp_identifier); /* SubjectConfirmation & Subject */ subject_confirmation = lasso_saml_subject_confirmation_new(); diff --git a/lasso/Attic/protocols/elements/authentication_statement.h b/lasso/Attic/protocols/elements/authentication_statement.h index 4ee99c59..0b354349 100644 --- a/lasso/Attic/protocols/elements/authentication_statement.h +++ b/lasso/Attic/protocols/elements/authentication_statement.h @@ -55,7 +55,7 @@ struct _LassoAuthenticationStatementClass { LASSO_EXPORT GType lasso_authentication_statement_get_type (void); LASSO_EXPORT LassoNode* lasso_authentication_statement_new (const xmlChar *authenticationMethod, const xmlChar *reauthenticateOnOrAfter, - LassoSamlNameIdentifier *identifier, + LassoSamlNameIdentifier *sp_identifier, LassoSamlNameIdentifier *idp_identifier); #ifdef __cplusplus |