summaryrefslogtreecommitdiffstats
path: root/lasso/xml/lib_authn_response.c
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2004-11-17 23:04:57 +0000
committerFrederic Peters <fpeters@entrouvert.com>2004-11-17 23:04:57 +0000
commit59bdda3549b13cbe97ce49fdb541f8bad006f08e (patch)
tree5f8809c208fafea2e5fda8078b032636ebece261 /lasso/xml/lib_authn_response.c
parentcfc07351978eef632c1b06f06f7246c2860cfc9c (diff)
downloadlasso-59bdda3549b13cbe97ce49fdb541f8bad006f08e.tar.gz
lasso-59bdda3549b13cbe97ce49fdb541f8bad006f08e.tar.xz
lasso-59bdda3549b13cbe97ce49fdb541f8bad006f08e.zip
use same "xmlsnippets" (name will probably change) to build xml nodes
Diffstat (limited to 'lasso/xml/lib_authn_response.c')
-rw-r--r--lasso/xml/lib_authn_response.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/lasso/xml/lib_authn_response.c b/lasso/xml/lib_authn_response.c
index 558e4763..238c888b 100644
--- a/lasso/xml/lib_authn_response.c
+++ b/lasso/xml/lib_authn_response.c
@@ -57,24 +57,26 @@ From liberty-metadata-v1.0.xsd:
/* private methods */
/*****************************************************************************/
+#define snippets() \
+ LassoLibAuthnResponse *response = LASSO_LIB_AUTHN_RESPONSE(node); \
+ struct XmlSnippet snippets[] = { \
+ { "ProviderID", 'c', (void**)&(response->ProviderID) }, \
+ { "RelayState", 'c', (void**)&(response->RelayState) }, \
+ { NULL, 0, NULL} \
+ };
+
static LassoNodeClass *parent_class = NULL;
static xmlNode*
get_xmlNode(LassoNode *node)
{
- LassoLibAuthnResponse *response = LASSO_LIB_AUTHN_RESPONSE(node);
xmlNode *xmlnode;
+ snippets();
xmlnode = parent_class->get_xmlNode(node);
xmlNodeSetName(xmlnode, "AuthnResponse");
xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_LIB_HREF, LASSO_LIB_PREFIX));
-
- if (response->ProviderID)
- xmlNewTextChild(xmlnode, NULL, "ProviderID", response->ProviderID);
-
- if (response->RelayState)
- xmlNewTextChild(xmlnode, NULL, "RelayState", response->RelayState);
-
+ lasso_node_build_xml_with_snippets(xmlnode, snippets);
if (response->consent)
xmlSetProp(xmlnode, "consent", response->consent);
@@ -84,12 +86,7 @@ get_xmlNode(LassoNode *node)
static int
init_from_xml(LassoNode *node, xmlNode *xmlnode)
{
- LassoLibAuthnResponse *response = LASSO_LIB_AUTHN_RESPONSE(node);
- struct XmlSnippet snippets[] = {
- { "ProviderID", 'c', (void**)&(response->ProviderID) },
- { "RelayState", 'c', (void**)&(response->RelayState) },
- { NULL, 0, NULL}
- };
+ snippets();
if (parent_class->init_from_xml(node, xmlnode))
return -1;