diff options
author | Frederic Peters <fpeters@entrouvert.com> | 2004-11-17 17:18:51 +0000 |
---|---|---|
committer | Frederic Peters <fpeters@entrouvert.com> | 2004-11-17 17:18:51 +0000 |
commit | cfc07351978eef632c1b06f06f7246c2860cfc9c (patch) | |
tree | 48a7d9f6507e35a980e530efad2f58b757510417 /lasso/xml/lib_authn_request.c | |
parent | 5c353c8fe9b439478c333c7ec1604a4d12fcadaa (diff) | |
download | lasso-cfc07351978eef632c1b06f06f7246c2860cfc9c.tar.gz lasso-cfc07351978eef632c1b06f06f7246c2860cfc9c.tar.xz lasso-cfc07351978eef632c1b06f06f7246c2860cfc9c.zip |
refactored init_from_xml functions (lasso is now less than 20000 lines)
Diffstat (limited to 'lasso/xml/lib_authn_request.c')
-rw-r--r-- | lasso/xml/lib_authn_request.c | 78 |
1 files changed, 27 insertions, 51 deletions
diff --git a/lasso/xml/lib_authn_request.c b/lasso/xml/lib_authn_request.c index 7d3ad054..f99e9719 100644 --- a/lasso/xml/lib_authn_request.c +++ b/lasso/xml/lib_authn_request.c @@ -215,60 +215,36 @@ init_from_xml(LassoNode *node, xmlNode *xmlnode) xmlNode *t, *n; char *s; int rc; + char *force_authn = NULL, *is_passive = NULL; + struct XmlSnippet snippets[] = { + { "ProviderID", 'c', (void**)&(request->ProviderID) }, + { "NameIDPolicy", 'c', (void**)&(request->NameIDPolicy) }, + { "ProtocolProfile", 'c', (void**)&(request->ProtocolProfile) }, + { "AssertionConsumerServiceID", 'c', + (void**)&(request->AssertionConsumerServiceID) }, + /* XXX: RequestAuthnContext */ + { "RelayState", 'c', (void**)&(request->RelayState) }, + { "ForceAuthn", 'c', (void**)&force_authn }, + { "IsPassive", 'c', (void**)&is_passive }, + /* XXX: Scoping */ + { NULL, 0, NULL} + }; + + if (parent_class->init_from_xml(node, xmlnode)) + return -1; - rc = parent_class->init_from_xml(node, xmlnode); - if (rc) - return rc; + request->consent = xmlGetProp(xmlnode, "consent"); + lasso_node_init_xml_with_snippets(xmlnode, snippets); - t = xmlnode->children; - while (t) { - n = t; - t = t->next; - if (n->type != XML_ELEMENT_NODE) { - continue; - } - if (strcmp(n->name, "ProviderID") == 0) { - request->ProviderID = xmlNodeGetContent(n); - continue; - } - if (strcmp(n->name, "NameIDPolicy") == 0) { - request->NameIDPolicy = xmlNodeGetContent(n); - continue; - } - if (strcmp(n->name, "ForceAuthn") == 0) { - s = xmlNodeGetContent(n); - request->ForceAuthn = (strcmp(s, "true") == 0); - xmlFree(s); - continue; - } - if (strcmp(n->name, "IsPassive") == 0) { - s = xmlNodeGetContent(n); - request->IsPassive = (strcmp(s, "true") == 0); - xmlFree(s); - continue; - } - if (strcmp(n->name, "ProtocolProfile") == 0) { - request->ProtocolProfile = xmlNodeGetContent(n); - continue; - } - if (strcmp(n->name, "AssertionConsumerServiceID") == 0) { - request->AssertionConsumerServiceID = xmlNodeGetContent(n); - continue; - } - if (strcmp(n->name, "RequestAuthnContext") == 0) { - /* XXX */ - continue; - } - if (strcmp(n->name, "RelayState") == 0) { - request->RelayState = xmlNodeGetContent(n); - continue; - } - if (strcmp(n->name, "Scoping") == 0) { - /* XXX */ - continue; - } + if (is_passive) { + request->IsPassive = (strcmp(is_passive, "true") == 0); + xmlFree(is_passive); } - request->consent = xmlGetProp(xmlnode, "consent"); + if (force_authn) { + request->ForceAuthn = (strcmp(force_authn, "true") == 0); + xmlFree(force_authn); + } + return 0; } |