diff options
author | Frederic Peters <fpeters@entrouvert.com> | 2004-12-17 12:32:48 +0000 |
---|---|---|
committer | Frederic Peters <fpeters@entrouvert.com> | 2004-12-17 12:32:48 +0000 |
commit | 9f80e375171f987aa6680e9ccd42ae599b80eca6 (patch) | |
tree | 4dfd2501f4ada04aaaa074cb5a5dda8be54fe73f /lasso/xml/samlp_status.c | |
parent | f44d34eecbc4cf28d4831138a3b6544716c12c6d (diff) | |
download | lasso-9f80e375171f987aa6680e9ccd42ae599b80eca6.tar.gz lasso-9f80e375171f987aa6680e9ccd42ae599b80eca6.tar.xz lasso-9f80e375171f987aa6680e9ccd42ae599b80eca6.zip |
Done with the new query snippets system (everything but the IDPEntries in
<lib:AuthnRequest>). It has nested <samlp:StatusCode> support but ID-FF layer
must still be updated to produce them.
Diffstat (limited to 'lasso/xml/samlp_status.c')
-rw-r--r-- | lasso/xml/samlp_status.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/lasso/xml/samlp_status.c b/lasso/xml/samlp_status.c index 4f3b5fae..a9649d6f 100644 --- a/lasso/xml/samlp_status.c +++ b/lasso/xml/samlp_status.c @@ -50,11 +50,52 @@ static struct XmlSnippet schema_snippets[] = { { NULL, 0, 0} }; +static gchar* +build_query(LassoNode *node) +{ + LassoSamlpStatusCode *code = LASSO_SAMLP_STATUS(node)->StatusCode; + GString *s; + char *t; + + s = g_string_sized_new(200); + while (code) { + if (s->len) + g_string_append(s, " "); + g_string_append(s, code->Value); + code = code->StatusCode; + } + + t = s->str; + g_string_free(s, FALSE); + return t; +} + +static gboolean +init_from_query(LassoNode *node, char **query_fields) +{ + char **values; + LassoSamlpStatusCode *code; + int i; + + code = lasso_samlp_status_code_new(); + LASSO_SAMLP_STATUS(node)->StatusCode = code; + values = g_strsplit(*query_fields, " ", 0); + for (i = 0; values[i]; i++) { + code->Value = g_strdup(values[i]); + if (values[i+1]) { + code->StatusCode = lasso_samlp_status_code_new(); + code = code->StatusCode; + } + } + + g_strfreev(values); + return TRUE; +} + /*****************************************************************************/ /* instance and class init functions */ /*****************************************************************************/ - static void instance_init(LassoSamlpStatus *node) { @@ -67,6 +108,8 @@ class_init(LassoSamlpStatusClass *klass) { LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + nclass->build_query = build_query; + nclass->init_from_query = init_from_query; nclass->node_data = g_new0(LassoNodeClassData, 1); lasso_node_class_set_nodename(nclass, "Status"); lasso_node_class_set_ns(nclass, LASSO_SAML_PROTOCOL_HREF, LASSO_SAML_PROTOCOL_PREFIX); |