summaryrefslogtreecommitdiffstats
path: root/lasso/xml
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2004-12-28 12:44:22 +0000
committerFrederic Peters <fpeters@entrouvert.com>2004-12-28 12:44:22 +0000
commit07fcdf0c4e3c89941e45f353e92c715875de08c1 (patch)
treea610faff5fdc3c02304e928177cfe9edb4368921 /lasso/xml
parent86fdb04dc0d0803855a2ecd207eeebb9279bfc75 (diff)
downloadlasso-07fcdf0c4e3c89941e45f353e92c715875de08c1.tar.gz
lasso-07fcdf0c4e3c89941e45f353e92c715875de08c1.tar.xz
lasso-07fcdf0c4e3c89941e45f353e92c715875de08c1.zip
generate xmlsec signatures in get_xmlNode; this should allow envelopes (in
LECP) to work properly.
Diffstat (limited to 'lasso/xml')
-rw-r--r--lasso/xml/lib_authn_response.c4
-rw-r--r--lasso/xml/lib_authn_response.h2
-rw-r--r--lasso/xml/lib_federation_termination_notification.c7
-rw-r--r--lasso/xml/lib_federation_termination_notification.h4
-rw-r--r--lasso/xml/lib_logout_request.c7
-rw-r--r--lasso/xml/lib_logout_request.h4
-rw-r--r--lasso/xml/lib_logout_response.c6
-rw-r--r--lasso/xml/lib_logout_response.h4
-rw-r--r--lasso/xml/lib_name_identifier_mapping_request.c7
-rw-r--r--lasso/xml/lib_name_identifier_mapping_request.h4
-rw-r--r--lasso/xml/lib_name_identifier_mapping_response.c6
-rw-r--r--lasso/xml/lib_name_identifier_mapping_response.h4
-rw-r--r--lasso/xml/lib_register_name_identifier_request.c6
-rw-r--r--lasso/xml/lib_register_name_identifier_request.h4
-rw-r--r--lasso/xml/lib_register_name_identifier_response.c6
-rw-r--r--lasso/xml/lib_register_name_identifier_response.h4
-rw-r--r--lasso/xml/samlp_request_abstract.c24
-rw-r--r--lasso/xml/samlp_request_abstract.h2
-rw-r--r--lasso/xml/samlp_response.c4
-rw-r--r--lasso/xml/samlp_response.h2
-rw-r--r--lasso/xml/samlp_response_abstract.c24
-rw-r--r--lasso/xml/samlp_response_abstract.h2
-rw-r--r--lasso/xml/xml.c44
-rw-r--r--lasso/xml/xml.h8
24 files changed, 89 insertions, 100 deletions
diff --git a/lasso/xml/lib_authn_response.c b/lasso/xml/lib_authn_response.c
index a906817e..7a24afab 100644
--- a/lasso/xml/lib_authn_response.c
+++ b/lasso/xml/lib_authn_response.c
@@ -113,7 +113,7 @@ lasso_lib_authn_response_get_type()
return authn_response_type;
}
-LassoNode*
+LassoSamlpResponseAbstract*
lasso_lib_authn_response_new(char *providerID, LassoLibAuthnRequest *request)
{
LassoLibAuthnResponse *response;
@@ -129,6 +129,6 @@ lasso_lib_authn_response_new(char *providerID, LassoLibAuthnRequest *request)
response->RelayState = g_strdup(request->RelayState);
}
- return LASSO_NODE(response);
+ return LASSO_SAMLP_RESPONSE_ABSTRACT(response);
}
diff --git a/lasso/xml/lib_authn_response.h b/lasso/xml/lib_authn_response.h
index 2d16f5ad..b47045d1 100644
--- a/lasso/xml/lib_authn_response.h
+++ b/lasso/xml/lib_authn_response.h
@@ -69,7 +69,7 @@ struct _LassoLibAuthnResponseClass {
};
LASSO_EXPORT GType lasso_lib_authn_response_get_type(void);
-LASSO_EXPORT LassoNode* lasso_lib_authn_response_new(
+LASSO_EXPORT LassoSamlpResponseAbstract* lasso_lib_authn_response_new(
char *providerID, LassoLibAuthnRequest *request);
#ifdef __cplusplus
diff --git a/lasso/xml/lib_federation_termination_notification.c b/lasso/xml/lib_federation_termination_notification.c
index 7f9dd341..edf11cfa 100644
--- a/lasso/xml/lib_federation_termination_notification.c
+++ b/lasso/xml/lib_federation_termination_notification.c
@@ -196,13 +196,13 @@ lasso_lib_federation_termination_notification_get_type()
return this_type;
}
-LassoNode*
+LassoSamlpRequestAbstract*
lasso_lib_federation_termination_notification_new()
{
return g_object_new(LASSO_TYPE_LIB_FEDERATION_TERMINATION_NOTIFICATION, NULL);
}
-LassoNode*
+LassoSamlpRequestAbstract*
lasso_lib_federation_termination_notification_new_full(char *providerID,
LassoSamlNameIdentifier *nameIdentifier,
lassoSignatureType sign_type, lassoSignatureMethod sign_method)
@@ -222,6 +222,5 @@ lasso_lib_federation_termination_notification_new_full(char *providerID,
LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION(request)->NameIdentifier =
g_object_ref(nameIdentifier);
- return LASSO_NODE(request);
+ return request;
}
-
diff --git a/lasso/xml/lib_federation_termination_notification.h b/lasso/xml/lib_federation_termination_notification.h
index 1ae46c50..ddadfc86 100644
--- a/lasso/xml/lib_federation_termination_notification.h
+++ b/lasso/xml/lib_federation_termination_notification.h
@@ -75,8 +75,8 @@ struct _LassoLibFederationTerminationNotificationClass {
};
LASSO_EXPORT GType lasso_lib_federation_termination_notification_get_type(void);
-LASSO_EXPORT LassoNode* lasso_lib_federation_termination_notification_new(void);
-LASSO_EXPORT LassoNode* lasso_lib_federation_termination_notification_new_full(
+LASSO_EXPORT LassoSamlpRequestAbstract* lasso_lib_federation_termination_notification_new(void);
+LASSO_EXPORT LassoSamlpRequestAbstract* lasso_lib_federation_termination_notification_new_full(
char *providerID, LassoSamlNameIdentifier *nameIdentifier,
lassoSignatureType sign_type, lassoSignatureMethod sign_method);
diff --git a/lasso/xml/lib_logout_request.c b/lasso/xml/lib_logout_request.c
index f8de8826..7757b41c 100644
--- a/lasso/xml/lib_logout_request.c
+++ b/lasso/xml/lib_logout_request.c
@@ -171,13 +171,13 @@ lasso_lib_logout_request_get_type()
return this_type;
}
-LassoNode*
+LassoSamlpRequestAbstract*
lasso_lib_logout_request_new()
{
return g_object_new(LASSO_TYPE_LIB_LOGOUT_REQUEST, NULL);
}
-LassoNode*
+LassoSamlpRequestAbstract*
lasso_lib_logout_request_new_full(char *providerID, LassoSamlNameIdentifier *nameIdentifier,
lassoSignatureType sign_type, lassoSignatureMethod sign_method)
{
@@ -194,6 +194,5 @@ lasso_lib_logout_request_new_full(char *providerID, LassoSamlNameIdentifier *nam
LASSO_LIB_LOGOUT_REQUEST(request)->ProviderID = g_strdup(providerID);
LASSO_LIB_LOGOUT_REQUEST(request)->NameIdentifier = g_object_ref(nameIdentifier);
- return LASSO_NODE(request);
+ return request;
}
-
diff --git a/lasso/xml/lib_logout_request.h b/lasso/xml/lib_logout_request.h
index 4e4b3279..30f6ed1b 100644
--- a/lasso/xml/lib_logout_request.h
+++ b/lasso/xml/lib_logout_request.h
@@ -69,9 +69,9 @@ struct _LassoLibLogoutRequestClass {
};
LASSO_EXPORT GType lasso_lib_logout_request_get_type(void);
-LASSO_EXPORT LassoNode* lasso_lib_logout_request_new(void);
+LASSO_EXPORT LassoSamlpRequestAbstract* lasso_lib_logout_request_new(void);
-LASSO_EXPORT LassoNode* lasso_lib_logout_request_new_full(
+LASSO_EXPORT LassoSamlpRequestAbstract* lasso_lib_logout_request_new_full(
char *providerID, LassoSamlNameIdentifier *nameIdentifier,
lassoSignatureType sign_type, lassoSignatureMethod sign_method);
diff --git a/lasso/xml/lib_logout_response.c b/lasso/xml/lib_logout_response.c
index 8c5bfab9..8652da94 100644
--- a/lasso/xml/lib_logout_response.c
+++ b/lasso/xml/lib_logout_response.c
@@ -78,13 +78,13 @@ lasso_lib_logout_response_get_type()
return logout_response_type;
}
-LassoNode*
+LassoSamlpResponseAbstract*
lasso_lib_logout_response_new()
{
return g_object_new(LASSO_TYPE_LIB_LOGOUT_RESPONSE, NULL);
}
-LassoNode*
+LassoSamlpResponseAbstract*
lasso_lib_logout_response_new_full(char *providerID, const char *statusCodeValue,
LassoLibLogoutRequest *request,
lassoSignatureType sign_type, lassoSignatureMethod sign_method)
@@ -105,6 +105,6 @@ lasso_lib_logout_response_new_full(char *providerID, const char *statusCodeValue
response->Status->StatusCode = lasso_samlp_status_code_new();
response->Status->StatusCode->Value = g_strdup(statusCodeValue);
- return LASSO_NODE(response);
+ return LASSO_SAMLP_RESPONSE_ABSTRACT(response);
}
diff --git a/lasso/xml/lib_logout_response.h b/lasso/xml/lib_logout_response.h
index d43dbf09..6de78e88 100644
--- a/lasso/xml/lib_logout_response.h
+++ b/lasso/xml/lib_logout_response.h
@@ -59,9 +59,9 @@ struct _LassoLibLogoutResponseClass {
};
LASSO_EXPORT GType lasso_lib_logout_response_get_type(void);
-LASSO_EXPORT LassoNode* lasso_lib_logout_response_new(void);
+LASSO_EXPORT LassoSamlpResponseAbstract* lasso_lib_logout_response_new(void);
-LASSO_EXPORT LassoNode* lasso_lib_logout_response_new_full(
+LASSO_EXPORT LassoSamlpResponseAbstract* lasso_lib_logout_response_new_full(
char *providerID, const char *statusCodeValue,
LassoLibLogoutRequest *request,
lassoSignatureType sign_type, lassoSignatureMethod sign_method);
diff --git a/lasso/xml/lib_name_identifier_mapping_request.c b/lasso/xml/lib_name_identifier_mapping_request.c
index 9f7c727d..348cf38a 100644
--- a/lasso/xml/lib_name_identifier_mapping_request.c
+++ b/lasso/xml/lib_name_identifier_mapping_request.c
@@ -120,13 +120,13 @@ lasso_lib_name_identifier_mapping_request_get_type()
return this_type;
}
-LassoNode*
+LassoSamlpRequestAbstract*
lasso_lib_name_identifier_mapping_request_new()
{
return g_object_new(LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_REQUEST, NULL);
}
-LassoNode*
+LassoSamlpRequestAbstract*
lasso_lib_name_identifier_mapping_request_new_full(char *providerID,
LassoSamlNameIdentifier *nameIdentifier, const char *targetNamespace,
lassoSignatureType sign_type, lassoSignatureMethod sign_method)
@@ -152,6 +152,5 @@ lasso_lib_name_identifier_mapping_request_new_full(char *providerID,
/* XXX: consent ? */
- return LASSO_NODE(request);
+ return request;
}
-
diff --git a/lasso/xml/lib_name_identifier_mapping_request.h b/lasso/xml/lib_name_identifier_mapping_request.h
index b200b876..1dbd313c 100644
--- a/lasso/xml/lib_name_identifier_mapping_request.h
+++ b/lasso/xml/lib_name_identifier_mapping_request.h
@@ -74,8 +74,8 @@ struct _LassoLibNameIdentifierMappingRequestClass {
};
LASSO_EXPORT GType lasso_lib_name_identifier_mapping_request_get_type(void);
-LASSO_EXPORT LassoNode* lasso_lib_name_identifier_mapping_request_new(void);
-LASSO_EXPORT LassoNode* lasso_lib_name_identifier_mapping_request_new_full(
+LASSO_EXPORT LassoSamlpRequestAbstract* lasso_lib_name_identifier_mapping_request_new(void);
+LASSO_EXPORT LassoSamlpRequestAbstract* lasso_lib_name_identifier_mapping_request_new_full(
char *providerID, LassoSamlNameIdentifier *nameIdentifier,
const char *targetNamespace,
lassoSignatureType sign_type, lassoSignatureMethod sign_method);
diff --git a/lasso/xml/lib_name_identifier_mapping_response.c b/lasso/xml/lib_name_identifier_mapping_response.c
index 2edc26a2..589018ef 100644
--- a/lasso/xml/lib_name_identifier_mapping_response.c
+++ b/lasso/xml/lib_name_identifier_mapping_response.c
@@ -109,13 +109,13 @@ lasso_lib_name_identifier_mapping_response_get_type()
return name_identifier_mapping_response_type;
}
-LassoNode*
+LassoSamlpResponseAbstract*
lasso_lib_name_identifier_mapping_response_new()
{
return g_object_new(LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL);
}
-LassoNode*
+LassoSamlpResponseAbstract*
lasso_lib_name_identifier_mapping_response_new_full(char *providerID, const char *statusCodeValue,
LassoLibNameIdentifierMappingRequest *request,
lassoSignatureType sign_type, lassoSignatureMethod sign_method)
@@ -135,6 +135,6 @@ lasso_lib_name_identifier_mapping_response_new_full(char *providerID, const char
response->Status->StatusCode = lasso_samlp_status_code_new();
response->Status->StatusCode->Value = g_strdup(statusCodeValue);
- return LASSO_NODE(response);
+ return LASSO_SAMLP_RESPONSE_ABSTRACT(response);
}
diff --git a/lasso/xml/lib_name_identifier_mapping_response.h b/lasso/xml/lib_name_identifier_mapping_response.h
index ca27a27a..17a58292 100644
--- a/lasso/xml/lib_name_identifier_mapping_response.h
+++ b/lasso/xml/lib_name_identifier_mapping_response.h
@@ -74,9 +74,9 @@ struct _LassoLibNameIdentifierMappingResponseClass {
};
LASSO_EXPORT GType lasso_lib_name_identifier_mapping_response_get_type(void);
-LASSO_EXPORT LassoNode* lasso_lib_name_identifier_mapping_response_new(void);
+LASSO_EXPORT LassoSamlpResponseAbstract* lasso_lib_name_identifier_mapping_response_new(void);
-LASSO_EXPORT LassoNode* lasso_lib_name_identifier_mapping_response_new_full(
+LASSO_EXPORT LassoSamlpResponseAbstract* lasso_lib_name_identifier_mapping_response_new_full(
char *provideRID, const char *statusCodeValue,
LassoLibNameIdentifierMappingRequest *request,
lassoSignatureType sign_type, lassoSignatureMethod sign_method);
diff --git a/lasso/xml/lib_register_name_identifier_request.c b/lasso/xml/lib_register_name_identifier_request.c
index 3825fa2a..0df41d09 100644
--- a/lasso/xml/lib_register_name_identifier_request.c
+++ b/lasso/xml/lib_register_name_identifier_request.c
@@ -195,13 +195,13 @@ lasso_lib_register_name_identifier_request_get_type()
return this_type;
}
-LassoNode*
+LassoSamlpRequestAbstract*
lasso_lib_register_name_identifier_request_new()
{
return g_object_new(LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_REQUEST, NULL);
}
-LassoNode*
+LassoSamlpRequestAbstract*
lasso_lib_register_name_identifier_request_new_full(const char *providerID,
LassoSamlNameIdentifier *idpNameIdentifier,
LassoSamlNameIdentifier *spNameIdentifier,
@@ -226,7 +226,7 @@ lasso_lib_register_name_identifier_request_new_full(const char *providerID,
request->SPProvidedNameIdentifier = spNameIdentifier;
request->OldProvidedNameIdentifier = oldNameIdentifier;
- return LASSO_NODE(request);
+ return request_base;
}
diff --git a/lasso/xml/lib_register_name_identifier_request.h b/lasso/xml/lib_register_name_identifier_request.h
index 6346bab4..6d8ca82a 100644
--- a/lasso/xml/lib_register_name_identifier_request.h
+++ b/lasso/xml/lib_register_name_identifier_request.h
@@ -77,8 +77,8 @@ struct _LassoLibRegisterNameIdentifierRequestClass {
};
LASSO_EXPORT GType lasso_lib_register_name_identifier_request_get_type(void);
-LASSO_EXPORT LassoNode* lasso_lib_register_name_identifier_request_new(void);
-LASSO_EXPORT LassoNode* lasso_lib_register_name_identifier_request_new_full(
+LASSO_EXPORT LassoSamlpRequestAbstract* lasso_lib_register_name_identifier_request_new(void);
+LASSO_EXPORT LassoSamlpRequestAbstract* lasso_lib_register_name_identifier_request_new_full(
const char *providerID,
LassoSamlNameIdentifier *idpNameIdentifier,
LassoSamlNameIdentifier *spNameIdentifier,
diff --git a/lasso/xml/lib_register_name_identifier_response.c b/lasso/xml/lib_register_name_identifier_response.c
index 2f0cc471..ab59604f 100644
--- a/lasso/xml/lib_register_name_identifier_response.c
+++ b/lasso/xml/lib_register_name_identifier_response.c
@@ -80,13 +80,13 @@ lasso_lib_register_name_identifier_response_get_type()
return register_name_identifier_response_type;
}
-LassoNode*
+LassoSamlpResponseAbstract*
lasso_lib_register_name_identifier_response_new()
{
return g_object_new(LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE, NULL);
}
-LassoNode*
+LassoSamlpResponseAbstract*
lasso_lib_register_name_identifier_response_new_full(const char *providerID,
const char *statusCodeValue, LassoLibRegisterNameIdentifierRequest *request,
lassoSignatureType sign_type, lassoSignatureMethod sign_method)
@@ -108,6 +108,6 @@ lasso_lib_register_name_identifier_response_new_full(const char *providerID,
response->Status->StatusCode = lasso_samlp_status_code_new();
response->Status->StatusCode->Value = g_strdup(statusCodeValue);
- return LASSO_NODE(response);
+ return LASSO_SAMLP_RESPONSE_ABSTRACT(response);
}
diff --git a/lasso/xml/lib_register_name_identifier_response.h b/lasso/xml/lib_register_name_identifier_response.h
index f99f6ca2..d747419b 100644
--- a/lasso/xml/lib_register_name_identifier_response.h
+++ b/lasso/xml/lib_register_name_identifier_response.h
@@ -62,8 +62,8 @@ struct _LassoLibRegisterNameIdentifierResponseClass {
};
LASSO_EXPORT GType lasso_lib_register_name_identifier_response_get_type(void);
-LASSO_EXPORT LassoNode* lasso_lib_register_name_identifier_response_new(void);
-LASSO_EXPORT LassoNode* lasso_lib_register_name_identifier_response_new_full(
+LASSO_EXPORT LassoSamlpResponseAbstract* lasso_lib_register_name_identifier_response_new(void);
+LASSO_EXPORT LassoSamlpResponseAbstract* lasso_lib_register_name_identifier_response_new_full(
const char *providerID, const char *statusCodeValue,
LassoLibRegisterNameIdentifierRequest *request,
lassoSignatureType sign_type, lassoSignatureMethod sign_method);
diff --git a/lasso/xml/samlp_request_abstract.c b/lasso/xml/samlp_request_abstract.c
index 4500988f..83c41af4 100644
--- a/lasso/xml/samlp_request_abstract.c
+++ b/lasso/xml/samlp_request_abstract.c
@@ -67,12 +67,25 @@ static struct XmlSnippet schema_snippets[] = {
{ NULL, 0, 0}
};
-static char*
-get_sign_attr_name()
+static LassoNodeClass *parent_class = NULL;
+
+static xmlNode*
+get_xmlNode(LassoNode *node, gboolean lasso_dump)
{
- return "RequestID";
-}
+ LassoSamlpRequestAbstract *request = LASSO_SAMLP_REQUEST_ABSTRACT(node);
+ xmlNode *xmlnode;
+ int rc;
+
+ xmlnode = parent_class->get_xmlNode(node, lasso_dump);
+ if (lasso_dump == FALSE && request->sign_type) {
+ rc = lasso_sign_node(xmlnode, "RequestID", request->RequestID,
+ request->private_key_file, request->certificate_file);
+ /* signature may have failed; what to do ? */
+ }
+
+ return xmlnode;
+}
/*****************************************************************************/
/* instance and class init functions */
@@ -94,7 +107,8 @@ class_init(LassoSamlpRequestAbstractClass *klass)
{
LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
- nclass->get_sign_attr_name = get_sign_attr_name;
+ parent_class = g_type_class_peek_parent(klass);
+ nclass->get_xmlNode = get_xmlNode;
nclass->node_data = g_new0(LassoNodeClassData, 1);
lasso_node_class_set_nodename(nclass, "RequestAbstract");
lasso_node_class_set_ns(nclass, LASSO_SAML_PROTOCOL_HREF, LASSO_SAML_PROTOCOL_PREFIX);
diff --git a/lasso/xml/samlp_request_abstract.h b/lasso/xml/samlp_request_abstract.h
index 07d40e6e..e24688a9 100644
--- a/lasso/xml/samlp_request_abstract.h
+++ b/lasso/xml/samlp_request_abstract.h
@@ -68,6 +68,8 @@ struct _LassoSamlpRequestAbstract {
/* ds:Signature stuffs */
lassoSignatureType sign_type;
lassoSignatureMethod sign_method;
+ char *private_key_file;
+ char *certificate_file;
};
struct _LassoSamlpRequestAbstractClass {
diff --git a/lasso/xml/samlp_response.c b/lasso/xml/samlp_response.c
index 5638538c..85c31999 100644
--- a/lasso/xml/samlp_response.c
+++ b/lasso/xml/samlp_response.c
@@ -124,7 +124,7 @@ lasso_samlp_response_get_type()
return response_type;
}
-LassoNode*
+LassoSamlpResponseAbstract*
lasso_samlp_response_new()
{
LassoSamlpResponseAbstract *response;
@@ -146,6 +146,6 @@ lasso_samlp_response_new()
status->StatusCode = status_code;
LASSO_SAMLP_RESPONSE(response)->Status = status;
- return LASSO_NODE(response);
+ return response;
}
diff --git a/lasso/xml/samlp_response.h b/lasso/xml/samlp_response.h
index 5e081531..bde65a30 100644
--- a/lasso/xml/samlp_response.h
+++ b/lasso/xml/samlp_response.h
@@ -64,7 +64,7 @@ struct _LassoSamlpResponseClass {
};
LASSO_EXPORT GType lasso_samlp_response_get_type(void);
-LASSO_EXPORT LassoNode* lasso_samlp_response_new(void);
+LASSO_EXPORT LassoSamlpResponseAbstract* lasso_samlp_response_new(void);
#ifdef __cplusplus
diff --git a/lasso/xml/samlp_response_abstract.c b/lasso/xml/samlp_response_abstract.c
index 5f86e10d..1d24b5b7 100644
--- a/lasso/xml/samlp_response_abstract.c
+++ b/lasso/xml/samlp_response_abstract.c
@@ -73,12 +73,25 @@ static struct XmlSnippet schema_snippets[] = {
{ NULL, 0, 0}
};
-static char*
-get_sign_attr_name()
+static LassoNodeClass *parent_class = NULL;
+
+static xmlNode*
+get_xmlNode(LassoNode *node, gboolean lasso_dump)
{
- return "ResponseID";
-}
+ LassoSamlpResponseAbstract *response = LASSO_SAMLP_RESPONSE_ABSTRACT(node);
+ xmlNode *xmlnode;
+ int rc;
+
+ xmlnode = parent_class->get_xmlNode(node, lasso_dump);
+ if (lasso_dump == FALSE && response->sign_type) {
+ rc = lasso_sign_node(xmlnode, "ResponseID", response->ResponseID,
+ response->private_key_file, response->certificate_file);
+ /* signature may have failed; what to do ? */
+ }
+
+ return xmlnode;
+}
/*****************************************************************************/
/* instance and class init functions */
@@ -101,7 +114,8 @@ class_init(LassoSamlpResponseAbstractClass *klass)
{
LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
- nclass->get_sign_attr_name = get_sign_attr_name;
+ parent_class = g_type_class_peek_parent(klass);
+ nclass->get_xmlNode = get_xmlNode;
nclass->node_data = g_new0(LassoNodeClassData, 1);
lasso_node_class_set_nodename(nclass, "ResponseAbstract");
lasso_node_class_set_ns(nclass, LASSO_SAML_PROTOCOL_HREF, LASSO_SAML_PROTOCOL_PREFIX);
diff --git a/lasso/xml/samlp_response_abstract.h b/lasso/xml/samlp_response_abstract.h
index 89251f0c..62b0e76b 100644
--- a/lasso/xml/samlp_response_abstract.h
+++ b/lasso/xml/samlp_response_abstract.h
@@ -70,6 +70,8 @@ struct _LassoSamlpResponseAbstract {
/* ds:Signature stuffs */
lassoSignatureType sign_type;
lassoSignatureMethod sign_method;
+ char *private_key_file;
+ char *certificate_file;
};
struct _LassoSamlpResponseAbstractClass {
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index dfadaa4d..b07d5111 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -126,40 +126,9 @@ lasso_node_destroy(LassoNode *node)
}
}
-static xmlNode*
-lasso_node_export_to_signed_xmlnode(LassoNode *node,
- const char *private_key_file, const char *certificate_file)
-{
- xmlNode *message;
- char *id_attr_name = NULL, *id_value = NULL;
-
- message = lasso_node_get_xmlNode(node, FALSE);
-
- if (private_key_file) {
- int rc;
-
- if (LASSO_NODE_GET_CLASS(node)->get_sign_attr_name) {
- id_attr_name = LASSO_NODE_GET_CLASS(node)->get_sign_attr_name();
- id_value = xmlGetProp(message, id_attr_name);
- }
-
- rc = lasso_sign_node(message, id_attr_name, id_value,
- private_key_file, certificate_file);
- /* it may have failed; should we care and return NULL or let
- * the unsigned message go on the wire ? */
- if (id_value)
- xmlFree(id_value);
- }
-
- return message;
-}
-
-
/**
* lasso_node_export_to_base64:
* @node: a #LassoNode
- * @private_key_file: the path to the private key for signature (may be NULL)
- * @certificate_file: the path to the certificate for signature (may be NULL)
*
* Exports @node to a base64-encoded message.
*
@@ -167,8 +136,7 @@ lasso_node_export_to_signed_xmlnode(LassoNode *node,
* the caller.
**/
char*
-lasso_node_export_to_base64(LassoNode *node,
- const char *private_key_file, const char *certificate_file)
+lasso_node_export_to_base64(LassoNode *node)
{
xmlNode *message;
xmlOutputBufferPtr buf;
@@ -176,7 +144,7 @@ lasso_node_export_to_base64(LassoNode *node,
char *buffer;
char *ret;
- message = lasso_node_export_to_signed_xmlnode(node, private_key_file, certificate_file);
+ message = lasso_node_get_xmlNode(node, FALSE);
handler = xmlFindCharEncodingHandler("utf-8");
buf = xmlAllocOutputBuffer(handler);
@@ -223,8 +191,6 @@ lasso_node_export_to_query(LassoNode *node,
/**
* lasso_node_export_to_soap:
* @node: a #LassoNode
- * @private_key_file: the path to the private key for signature (may be NULL)
- * @certificate_file: the path to the certificate for signature (may be NULL)
*
* Exports @node to a SOAP message.
*
@@ -232,8 +198,7 @@ lasso_node_export_to_query(LassoNode *node,
* caller.
**/
char*
-lasso_node_export_to_soap(LassoNode *node,
- const char *private_key_file, const char *certificate_file)
+lasso_node_export_to_soap(LassoNode *node)
{
xmlNode *envelope, *body, *message;
xmlOutputBuffer *buf;
@@ -242,7 +207,7 @@ lasso_node_export_to_soap(LassoNode *node,
g_return_val_if_fail (LASSO_IS_NODE(node), NULL);
- message = lasso_node_export_to_signed_xmlnode(node, private_key_file, certificate_file);
+ message = lasso_node_get_xmlNode(node, FALSE);
envelope = xmlNewNode(NULL, "Envelope");
xmlSetNs(envelope, xmlNewNs(envelope, LASSO_SOAP_ENV_HREF, LASSO_SOAP_ENV_PREFIX));
@@ -712,7 +677,6 @@ class_init(LassoNodeClass *class)
class->destroy = lasso_node_impl_destroy;
class->init_from_query = NULL;
class->init_from_xml = lasso_node_impl_init_from_xml;
- class->get_sign_attr_name = NULL;
/* virtual private methods */
class->build_query = lasso_node_impl_build_query;
diff --git a/lasso/xml/xml.h b/lasso/xml/xml.h
index 105f8895..cff2f91d 100644
--- a/lasso/xml/xml.h
+++ b/lasso/xml/xml.h
@@ -90,8 +90,6 @@ struct _LassoNodeClass {
gboolean (* init_from_query) (LassoNode *node, char **query_fields);
int (* init_from_xml) (LassoNode *node, xmlNode *xmlnode);
xmlNode* (* get_xmlNode) (LassoNode *node, gboolean lasso_dump);
-
- char* (* get_sign_attr_name) ();
};
LASSO_EXPORT GType lasso_node_get_type(void);
@@ -104,14 +102,12 @@ LASSO_EXPORT LassoNode* lasso_node_new_from_xmlNode(xmlNode* node);
LASSO_EXPORT void lasso_node_destroy(LassoNode *node);
LASSO_EXPORT char* lasso_node_dump(LassoNode *node, const char *encoding, int format);
LASSO_EXPORT char* lasso_node_build_query(LassoNode *node);
-LASSO_EXPORT char* lasso_node_export_to_base64(LassoNode *node,
- const char *private_key_file, const char *certificate_file);
+LASSO_EXPORT char* lasso_node_export_to_base64(LassoNode *node);
LASSO_EXPORT char* lasso_node_export_to_query(LassoNode *node,
lassoSignatureMethod sign_method, const char *private_key_file);
-LASSO_EXPORT char* lasso_node_export_to_soap(LassoNode *node,
- const char *private_key_file, const char *certificate_file);
+LASSO_EXPORT char* lasso_node_export_to_soap(LassoNode *node);
LASSO_EXPORT xmlNode* lasso_node_get_xmlNode(LassoNode *node, gboolean lasso_dump);