diff options
| author | Frederic Peters <fpeters@entrouvert.com> | 2006-11-13 11:12:59 +0000 |
|---|---|---|
| committer | Frederic Peters <fpeters@entrouvert.com> | 2006-11-13 11:12:59 +0000 |
| commit | 5bcb4d9035296ff91c95f37cc84738c71447d34c (patch) | |
| tree | a1776d833de9bbf25af37134de34c73f3c6e05c8 | |
| parent | 394d1949f6010a94dabad77df8fcd04c89146f18 (diff) | |
| download | lasso-5bcb4d9035296ff91c95f37cc84738c71447d34c.tar.gz lasso-5bcb4d9035296ff91c95f37cc84738c71447d34c.tar.xz lasso-5bcb4d9035296ff91c95f37cc84738c71447d34c.zip | |
also dump private data; necessary for saml2 artifact support
| -rw-r--r-- | lasso/id-ff/profile.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lasso/id-ff/profile.c b/lasso/id-ff/profile.c index 442a3e75..89111085 100644 --- a/lasso/id-ff/profile.c +++ b/lasso/id-ff/profile.c @@ -388,6 +388,67 @@ static struct XmlSnippet schema_snippets[] = { static LassoNodeClass *parent_class = NULL; +static xmlNode* +get_xmlNode(LassoNode *node, gboolean lasso_dump) +{ + xmlNode *xmlnode; + LassoProfile *profile = LASSO_PROFILE(node); + + xmlnode = parent_class->get_xmlNode(node, lasso_dump); + + if (profile->private_data->artifact) { + xmlNewTextChild(xmlnode, NULL, (xmlChar*)"Artifact", + profile->private_data->artifact); + } + + if (profile->private_data->artifact_message) { + xmlNewTextChild(xmlnode, NULL, (xmlChar*)"ArtifactMessage", + profile->private_data->artifact_message); + } + + return xmlnode; +} + + +static int +init_from_xml(LassoNode *node, xmlNode *xmlnode) +{ + LassoProfile *profile = LASSO_PROFILE(node); + xmlNode *t; + + parent_class->init_from_xml(node, xmlnode); + + if (xmlnode == NULL) + return LASSO_ERROR_UNDEFINED; + + t = xmlnode->children; + while (t) { + xmlNode *t2 = t->children; + xmlChar *s; + + if (t->type != XML_ELEMENT_NODE) { + t = t->next; + continue; + } + + if (strcmp((char*)t->name, "Artifact") == 0) { + s = xmlNodeGetContent(t); + profile->private_data->artifact = g_strdup(s); + xmlFree(s); + } else if (strcmp((char*)t->name, "ArtifactMessage") == 0) { + s = xmlNodeGetContent(t); + profile->private_data->artifact_message = g_strdup(s); + xmlFree(s); + } + + t = t->next; + } + + return 0; +} + + + /*****************************************************************************/ /* overridden parent class methods */ /*****************************************************************************/ @@ -460,6 +521,8 @@ class_init(LassoProfileClass *klass) lasso_node_class_set_nodename(nclass, "Profile"); lasso_node_class_set_ns(nclass, LASSO_LASSO_HREF, LASSO_LASSO_PREFIX); lasso_node_class_add_snippets(nclass, schema_snippets); + nclass->get_xmlNode = get_xmlNode; + nclass->init_from_xml = init_from_xml; G_OBJECT_CLASS(klass)->dispose = dispose; G_OBJECT_CLASS(klass)->finalize = finalize; |
