diff --git a/bindings/bindings.py b/bindings/bindings.py index 1c75062f..0654be35 100644 --- a/bindings/bindings.py +++ b/bindings/bindings.py @@ -500,7 +500,7 @@ def parse_header(header_file): if member_name == 'parent': in_struct.parent = member_type else: - in_struct.members.append(field) + in_struct.members.append(field) elif line.startswith('LASSO_EXPORT '): while not line.strip().endswith(';'): i += 1 @@ -640,4 +640,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/configure.ac b/configure.ac index 58698c3b..e8a6cd3b 100644 --- a/configure.ac +++ b/configure.ac @@ -799,6 +799,7 @@ lasso/id-wsf/Makefile lasso/saml-2.0/Makefile lasso/id-wsf-2.0/Makefile lasso/xml/Makefile +lasso/xml/ecp/Makefile lasso/xml/saml-2.0/Makefile lasso/xml/soap-1.1/Makefile lasso/xml/id-wsf-2.0/Makefile diff --git a/docs/reference/lasso/lasso-docs.sgml b/docs/reference/lasso/lasso-docs.sgml index 21a44b8f..fead6fd9 100644 --- a/docs/reference/lasso/lasso-docs.sgml +++ b/docs/reference/lasso/lasso-docs.sgml @@ -183,6 +183,8 @@ the GNU General Public License< + + @@ -284,6 +286,9 @@ the GNU General Public License< + + + diff --git a/docs/reference/lasso/lasso-sections.txt b/docs/reference/lasso/lasso-sections.txt index ccf98fb8..72d00312 100644 --- a/docs/reference/lasso/lasso-sections.txt +++ b/docs/reference/lasso/lasso-sections.txt @@ -6157,3 +6157,38 @@ lasso_soap_envelope_get_sb2_user_interaction_header lasso_log_set_handler lasso_log_remove_handler + +
+paos_request +LassoPaosRequest +lasso_paos_request_validate +lasso_paos_request_new +
+ +
+paos_response +LassoPaosResponse +lasso_paos_response_validate +lasso_paos_response_new +
+ +
+ecp_request +LassoEcpRequest +lasso_ecp_request_validate +lasso_ecp_request_new +
+ +
+ecp_response +LassoEcpResponse +lasso_ecp_response_validate +lasso_ecp_response_new +
+ +
+ecp_relaystate +LassoEcpRelayState +lasso_ecp_relay_state_validate +lasso_ecp_relay_state_new +
diff --git a/lasso/Makefile.am b/lasso/Makefile.am index 008bdbba..751f9419 100644 --- a/lasso/Makefile.am +++ b/lasso/Makefile.am @@ -56,6 +56,7 @@ endif if MINGW liblasso_la_LIBADD = \ $(top_builddir)/lasso/xml/liblasso-xml.la \ + $(top_builddir)/lasso/xml/ecp/liblasso-xml-ecp.la \ $(top_builddir)/lasso/xml/saml-2.0/liblasso-xml-saml2.la \ $(top_builddir)/lasso/xml/soap-1.1/liblasso-xml-soap11.la \ $(top_builddir)/lasso/xml/dsig/liblasso-xml-dsig.la \ @@ -72,6 +73,7 @@ liblasso_la_LDFLAGS = -no-undefined -version-info @LASSO_VERSION_INFO@ \ -Wl,--add-stdcall-alias else liblasso_la_LIBADD = \ + $(top_builddir)/lasso/xml/ecp/liblasso-xml-ecp.la \ $(top_builddir)/lasso/xml/liblasso-xml.la \ $(top_builddir)/lasso/xml/saml-2.0/liblasso-xml-saml2.la \ $(top_builddir)/lasso/xml/soap-1.1/liblasso-xml-soap11.la \ diff --git a/lasso/xml/Makefile.am b/lasso/xml/Makefile.am index 6e34ae06..162c437d 100644 --- a/lasso/xml/Makefile.am +++ b/lasso/xml/Makefile.am @@ -1,5 +1,5 @@ MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = saml-2.0 soap-1.1 dsig +SUBDIRS = saml-2.0 soap-1.1 dsig ecp if WSF_ENABLED SUBDIRS += id-wsf-2.0 ws endif @@ -162,6 +162,8 @@ liblasso_xml_la_SOURCES = \ lib_status_response.c \ lib_subject.c \ misc_text_node.c \ + paos_request.c \ + paos_response.c \ saml_advice.c \ saml_assertion.c \ saml_attribute.c \ @@ -213,6 +215,8 @@ liblassoinclude_HEADERS = \ lib_status_response.h \ lib_subject.h \ misc_text_node.h \ + paos_request.h \ + paos_response.h \ saml_advice.h \ saml_assertion.h \ saml_attribute.h \ diff --git a/lasso/xml/ecp/Makefile.am b/lasso/xml/ecp/Makefile.am new file mode 100644 index 00000000..c4168d22 --- /dev/null +++ b/lasso/xml/ecp/Makefile.am @@ -0,0 +1,21 @@ +MAINTAINERCLEANFILES = Makefile.in + +liblassoincludedir = $(includedir)/lasso/xml/ecp + +INCLUDES = \ + -I$(top_builddir) \ + -I$(top_srcdir) \ + $(LASSO_CORE_CFLAGS) \ + -DG_LOG_DOMAIN=\"lasso\" + +noinst_LTLIBRARIES = liblasso-xml-ecp.la + +liblasso_xml_ecp_la_SOURCES = \ + ecp_request.c \ + ecp_response.c \ + ecp_relaystate.c + +liblassoinclude_HEADERS = \ + ecp_request.h \ + ecp_response.h \ + ecp_relaystate.h diff --git a/lasso/xml/ecp/ecp_relaystate.c b/lasso/xml/ecp/ecp_relaystate.c new file mode 100644 index 00000000..b4f4a3f1 --- /dev/null +++ b/lasso/xml/ecp/ecp_relaystate.c @@ -0,0 +1,197 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "../private.h" +#include "ecp_relaystate.h" + +/** + * SECTION:ecp_relaystate + * @short_description: <ecp:RelayState> + * + *
Schema fragment for ecp:RelayState + * + * + * + * + * + * + * + * + * + * ]]> + *
+ */ + +/*****************************************************************************/ +/* public methods */ +/*****************************************************************************/ + +/** + * lasso_ecp_relay_state_validate: + * @relaystate: The #LassoEcpRelayState + * + * Validates the #LassoEcpRelayState object conforms to required values. + * + * + * RelayState must be non-NULL + * mustUnderstand must be TRUE + * actor must be equal to #LASSO_SOAP_ENV_ACTOR + * + * + * Returns: 0 on success, error code otherwise + **/ +int +lasso_ecp_relay_state_validate(LassoEcpRelayState *relaystate) +{ + g_return_val_if_fail(LASSO_IS_ECP_RELAYSTATE(relaystate), + LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); + + if (relaystate->RelayState == NULL) { + error("%s.RelayState missing", G_OBJECT_CLASS_NAME(relaystate)); + return LASSO_XML_ERROR_NODE_CONTENT_NOT_FOUND; + } + + if (!relaystate->mustUnderstand) { + error("%s.mustUnderstand must be True", G_OBJECT_CLASS_NAME(relaystate)); + return LASSO_XML_ERROR_ATTR_VALUE_INVALID; + } + + if (relaystate->actor == NULL) { + error("%s.actor missing", G_OBJECT_CLASS_NAME(relaystate)); + return LASSO_XML_ERROR_ATTR_NOT_FOUND; + } + + if (lasso_strisnotequal(relaystate->actor, LASSO_SOAP_ENV_ACTOR)) { + error("%s.actor invalid, must be \"%s\" not \"%s\"", + G_OBJECT_CLASS_NAME(relaystate), + LASSO_SOAP_ENV_ACTOR, relaystate->actor); + return LASSO_XML_ERROR_ATTR_VALUE_INVALID; + } + + return 0; +} + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "RelayState", SNIPPET_TEXT_CHILD, G_STRUCT_OFFSET(LassoEcpRelayState, RelayState), NULL, NULL, NULL}, + { "mustUnderstand", SNIPPET_ATTRIBUTE | SNIPPET_BOOLEAN, + G_STRUCT_OFFSET(LassoEcpRelayState, mustUnderstand), NULL, LASSO_SOAP_ENV_PREFIX, LASSO_SOAP_ENV_HREF}, + { "actor", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoEcpRelayState, actor), NULL, LASSO_SOAP_ENV_PREFIX, LASSO_SOAP_ENV_HREF}, + {NULL, 0, 0, NULL, NULL, NULL} +}; + +static LassoNodeClass *parent_class = NULL; + +static int +init_from_xml(LassoNode *node, xmlNode *xmlnode) +{ + lasso_error_t rc = 0; + LassoEcpRelayState *relaystate = LASSO_ECP_RELAYSTATE(node); + + lasso_check_good_rc(parent_class->init_from_xml(node, xmlnode)); + lasso_check_good_rc(lasso_ecp_relay_state_validate(relaystate)); + + cleanup: + return rc; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + + +static void +class_init(LassoEcpRelayStateClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + parent_class = g_type_class_peek_parent(klass); + nclass->node_data = g_new0(LassoNodeClassData, 1); + nclass->init_from_xml = init_from_xml; + lasso_node_class_set_nodename(nclass, "RelayState"); + lasso_node_class_set_ns(nclass, LASSO_ECP_HREF, LASSO_ECP_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); +} + +GType +lasso_ecp_relay_state_get_type() +{ + static GType ecp_relay_state_type = 0; + + if (!ecp_relay_state_type) { + static const GTypeInfo relaystate_info = { + sizeof (LassoEcpRelayStateClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoEcpRelayState), + 0, + NULL, + NULL + }; + + ecp_relay_state_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoEcpRelayState", &relaystate_info, 0); + } + return ecp_relay_state_type; +} + + +/** + * lasso_ecp_relay_state_new: + * @RelayState: (allow-none): + * + * + * The #LassoEcpRelayState object is initialized as follows: + * + * RelayState = @RelayState (if non-NULL) + * mustUnderstand = TRUE + * actor = #LASSO_SOAP_ENV_ACTOR + * + * + * Returns: a newly created and initialized #LassoEcpRelayState object + **/ +LassoNode* +lasso_ecp_relay_state_new(const gchar *RelayState) +{ + LassoEcpRelayState *relaystate; + + relaystate = g_object_new(LASSO_TYPE_ECP_RELAYSTATE, NULL); + + if (RelayState) { + relaystate->RelayState = g_strdup(RelayState); + } + + relaystate->mustUnderstand = TRUE; + relaystate->actor = g_strdup(LASSO_SOAP_ENV_ACTOR); + + return LASSO_NODE(relaystate); +} diff --git a/lasso/xml/ecp/ecp_relaystate.h b/lasso/xml/ecp/ecp_relaystate.h new file mode 100644 index 00000000..2e5ad5f4 --- /dev/null +++ b/lasso/xml/ecp/ecp_relaystate.h @@ -0,0 +1,69 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef __LASSO_ECP_RELAYSTATE_H__ +#define __LASSO_ECP_RELAYSTATE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "../xml.h" + +#define LASSO_TYPE_ECP_RELAYSTATE (lasso_ecp_relay_state_get_type()) +#define LASSO_ECP_RELAYSTATE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_ECP_RELAYSTATE, LassoEcpRelayState)) +#define LASSO_ECP_RELAYSTATE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_ECP_RELAYSTATE, LassoEcpRelayStateClass)) +#define LASSO_IS_ECP_RELAYSTATE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_ECP_RELAYSTATE)) +#define LASSO_IS_ECP_RELAYSTATE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_ECP_RELAYSTATE)) +#define LASSO_ECP_RELAYSTATE_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_ECP_RELAYSTATE, LassoEcpRelayStateClass)) + +typedef struct _LassoEcpRelayState LassoEcpRelayState; +typedef struct _LassoEcpRelayStateClass LassoEcpRelayStateClass; + +struct _LassoEcpRelayState { + LassoNode parent; + + gchar *RelayState; + gboolean mustUnderstand; + gchar *actor; +}; + +struct _LassoEcpRelayStateClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT int lasso_ecp_relay_state_validate(LassoEcpRelayState *relaystate); +LASSO_EXPORT GType lasso_ecp_relay_state_get_type(void); +LASSO_EXPORT LassoNode* lasso_ecp_relay_state_new(const gchar *RelayState); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_ECP_RELAYSTATE_H__ */ diff --git a/lasso/xml/ecp/ecp_request.c b/lasso/xml/ecp/ecp_request.c new file mode 100644 index 00000000..4b4b7e16 --- /dev/null +++ b/lasso/xml/ecp/ecp_request.c @@ -0,0 +1,219 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "../private.h" +#include "ecp_request.h" + +/** + * SECTION:ecp_request + * @short_description: <ecp:Request> + * + *
Schema fragment for ecp:Request + * + * + * + * + * + * + * + * + * + * + * + * ]]> + *
+ */ + +/*****************************************************************************/ +/* public methods */ +/*****************************************************************************/ + +/** + * lasso_ecp_request_validate: + * @request: the #LassoEcpRequest object to validate + * + * Validates the #LassoEcpRequest object conforms to required values. + * + * + * mustUnderstand must be TRUE + * actor must be equal to #LASSO_SOAP_ENV_ACTOR + * + * + * Returns: 0 on success, error code otherwise + **/ +int +lasso_ecp_request_validate(LassoEcpRequest *request) +{ + g_return_val_if_fail(LASSO_IS_ECP_REQUEST(request), + LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); + + if (!request->mustUnderstand) { + error("%s.mustUnderstand must be True", G_OBJECT_CLASS_NAME(request)); + return LASSO_XML_ERROR_ATTR_VALUE_INVALID; + } + + if (request->actor == NULL) { + error("%s.actor missing", G_OBJECT_CLASS_NAME(request)); + return LASSO_XML_ERROR_ATTR_NOT_FOUND; + } + + if (lasso_strisnotequal(request->actor, LASSO_SOAP_ENV_ACTOR)) { + error("%s.actor invalid, must be \"%s\" not \"%s\"", + G_OBJECT_CLASS_NAME(request), + LASSO_SOAP_ENV_ACTOR, request->actor); + return LASSO_XML_ERROR_ATTR_VALUE_INVALID; + } + + return 0; +} + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "Issuer", SNIPPET_NODE, + G_STRUCT_OFFSET(LassoEcpRequest, Issuer), + "LassoSaml2NameID", LASSO_SAML2_ASSERTION_PREFIX, LASSO_SAML2_ASSERTION_HREF}, + { "IDPList", SNIPPET_NODE, + G_STRUCT_OFFSET(LassoEcpRequest, IDPList), NULL, LASSO_SAML2_PROTOCOL_PREFIX, LASSO_SAML2_PROTOCOL_HREF}, + { "mustUnderstand", SNIPPET_ATTRIBUTE | SNIPPET_BOOLEAN, + G_STRUCT_OFFSET(LassoEcpRequest, mustUnderstand), NULL, LASSO_SOAP_ENV_PREFIX, LASSO_SOAP_ENV_HREF}, + { "actor", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoEcpRequest, actor), NULL, LASSO_SOAP_ENV_PREFIX, LASSO_SOAP_ENV_HREF}, + { "ProviderName", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoEcpRequest, ProviderName), NULL, NULL, NULL}, + { "IsPassive", SNIPPET_ATTRIBUTE | SNIPPET_BOOLEAN, + G_STRUCT_OFFSET(LassoEcpRequest, IsPassive), NULL, NULL, NULL}, + {NULL, 0, 0, NULL, NULL, NULL} +}; + +static LassoNodeClass *parent_class = NULL; + +static int +init_from_xml(LassoNode *node, xmlNode *xmlnode) +{ + lasso_error_t rc = 0; + LassoEcpRequest *request = LASSO_ECP_REQUEST(node); + + lasso_check_good_rc(parent_class->init_from_xml(node, xmlnode)); + lasso_check_good_rc(lasso_ecp_request_validate(request)); + + cleanup: + return rc; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + + +static void +instance_init(LassoEcpRequest *node) +{ + node->IsPassive = TRUE; +} + +static void +class_init(LassoEcpRequestClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + parent_class = g_type_class_peek_parent(klass); + nclass->node_data = g_new0(LassoNodeClassData, 1); + nclass->init_from_xml = init_from_xml; + lasso_node_class_set_nodename(nclass, "Request"); + lasso_node_class_set_ns(nclass, LASSO_ECP_HREF, LASSO_ECP_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); +} + +GType +lasso_ecp_request_get_type() +{ + static GType ecp_request_type = 0; + + if (!ecp_request_type) { + static const GTypeInfo request_info = { + sizeof (LassoEcpRequestClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoEcpRequest), + 0, + (GInstanceInitFunc) instance_init, + NULL + }; + + ecp_request_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoEcpRequest", &request_info, 0); + } + return ecp_request_type; +} + + +/** + * lasso_ecp_request_new: + * @Issuer: + * @IsPassive: + * @ProviderName: + * @IDPList: (allow-none): + * + * Creates and intializes new #LassoEcpRequest object. + * + * The #LassoEcpRequest object is initialized as follows: + * + * Issuer = @Issuer + * IsPassive = @IsPassive + * ProviderName = @ProviderName + * IDPList = @IDPList (if non-NULL) + * mustUnderstand = TRUE + * actor = #LASSO_SOAP_ENV_ACTOR + * + * + * Returns: a newly created and initialized #LassoEcpRequest object + **/ +LassoNode* +lasso_ecp_request_new(const char *Issuer, gboolean IsPassive, + const gchar *ProviderName, LassoSamlp2IDPList *IDPList) +{ + LassoEcpRequest *request; + + request = g_object_new(LASSO_TYPE_ECP_REQUEST, NULL); + + request->Issuer = LASSO_SAML2_NAME_ID(lasso_saml2_name_id_new_with_string((char*)Issuer)); + + request->IsPassive = IsPassive; + request->ProviderName = g_strdup(ProviderName); + + if (IDPList) { + lasso_assign_gobject(request->IDPList, IDPList); + } + request->mustUnderstand = TRUE; + request->actor = g_strdup(LASSO_SOAP_ENV_ACTOR); + + return LASSO_NODE(request); +} diff --git a/lasso/xml/ecp/ecp_request.h b/lasso/xml/ecp/ecp_request.h new file mode 100644 index 00000000..45be3e27 --- /dev/null +++ b/lasso/xml/ecp/ecp_request.h @@ -0,0 +1,75 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef __LASSO_ECP_REQUEST_H__ +#define __LASSO_ECP_REQUEST_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "../xml.h" +#include "../saml-2.0/saml2_name_id.h" +#include "../saml-2.0/samlp2_idp_list.h" + +#define LASSO_TYPE_ECP_REQUEST (lasso_ecp_request_get_type()) +#define LASSO_ECP_REQUEST(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_ECP_REQUEST, LassoEcpRequest)) +#define LASSO_ECP_REQUEST_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_ECP_REQUEST, LassoEcpRequestClass)) +#define LASSO_IS_ECP_REQUEST(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_ECP_REQUEST)) +#define LASSO_IS_ECP_REQUEST_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_ECP_REQUEST)) +#define LASSO_ECP_REQUEST_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_ECP_REQUEST, LassoEcpRequestClass)) + +typedef struct _LassoEcpRequest LassoEcpRequest; +typedef struct _LassoEcpRequestClass LassoEcpRequestClass; + +struct _LassoEcpRequest { + LassoNode parent; + + LassoSaml2NameID *Issuer; + LassoSamlp2IDPList *IDPList; + gboolean mustUnderstand; + gchar *actor; + gchar *ProviderName; + gboolean IsPassive; +}; + +struct _LassoEcpRequestClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT int lasso_ecp_request_validate(LassoEcpRequest *request); +LASSO_EXPORT GType lasso_ecp_request_get_type(void); +LASSO_EXPORT LassoNode* lasso_ecp_request_new(const gchar *Issuer, gboolean IsPassive, + const gchar *ProviderName, LassoSamlp2IDPList *IDPList); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_ECP_REQUEST_H__ */ diff --git a/lasso/xml/ecp/ecp_response.c b/lasso/xml/ecp/ecp_response.c new file mode 100644 index 00000000..acbccce3 --- /dev/null +++ b/lasso/xml/ecp/ecp_response.c @@ -0,0 +1,194 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "../private.h" +#include "ecp_response.h" + +/** + * SECTION:ecp_response + * @short_description: <ecp:Response> + * + *
Schema fragment for ecp:Response + * + * + * + * + * + * + * ]]> + *
+ */ + +/*****************************************************************************/ +/* public methods */ +/*****************************************************************************/ + +/** + * lasso_ecp_response_validate: + * @response: The #LassoEcpResponse object to validate + * + * Validates the #LassoEcpResponse object conforms to required values. + * + * + * AssertionConsumerServiceURL must be non-NULL + * mustUnderstand must be TRUE + * actor must be equal to #LASSO_SOAP_ENV_ACTOR + * + * + * Returns: 0 on success, error code otherwise + **/ +int +lasso_ecp_response_validate(LassoEcpResponse *response) +{ + g_return_val_if_fail(LASSO_IS_ECP_RESPONSE(response), + LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); + + if (response->AssertionConsumerServiceURL == NULL) { + error("%s.AssertionConsumerServiceURL missing", G_OBJECT_CLASS_NAME(response)); + return LASSO_XML_ERROR_ATTR_NOT_FOUND; + } + + if (!response->mustUnderstand) { + error("%s.mustUnderstand must be True", G_OBJECT_CLASS_NAME(response)); + return LASSO_XML_ERROR_ATTR_VALUE_INVALID; + } + + if (response->actor == NULL) { + error("%s.actor missing", G_OBJECT_CLASS_NAME(response)); + return LASSO_XML_ERROR_ATTR_NOT_FOUND; + } + + if (lasso_strisnotequal(response->actor, LASSO_SOAP_ENV_ACTOR)) { + error("%s.actor invalid, must be \"%s\" not \"%s\"", + G_OBJECT_CLASS_NAME(response), LASSO_SOAP_ENV_ACTOR, response->actor); + return LASSO_XML_ERROR_ATTR_VALUE_INVALID; + } + + return 0; +} + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "AssertionConsumerServiceURL", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoEcpResponse, AssertionConsumerServiceURL), NULL, NULL, NULL}, + { "mustUnderstand", SNIPPET_ATTRIBUTE | SNIPPET_BOOLEAN, + G_STRUCT_OFFSET(LassoEcpResponse, mustUnderstand), NULL, LASSO_SOAP_ENV_PREFIX, LASSO_SOAP_ENV_HREF}, + { "actor", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoEcpResponse, actor), NULL, LASSO_SOAP_ENV_PREFIX, LASSO_SOAP_ENV_HREF}, + {NULL, 0, 0, NULL, NULL, NULL} +}; + +static LassoNodeClass *parent_class = NULL; + +static int +init_from_xml(LassoNode *node, xmlNode *xmlnode) +{ + lasso_error_t rc = 0; + LassoEcpResponse *response = LASSO_ECP_RESPONSE(node); + + lasso_check_good_rc(parent_class->init_from_xml(node, xmlnode)); + lasso_check_good_rc(lasso_ecp_response_validate(response)); + + cleanup: + return rc; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + + +static void +class_init(LassoEcpResponseClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + parent_class = g_type_class_peek_parent(klass); + nclass->node_data = g_new0(LassoNodeClassData, 1); + nclass->init_from_xml = init_from_xml; + lasso_node_class_set_nodename(nclass, "Response"); + lasso_node_class_set_ns(nclass, LASSO_ECP_HREF, LASSO_ECP_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); +} + +GType +lasso_ecp_response_get_type() +{ + static GType ecp_response_type = 0; + + if (!ecp_response_type) { + static const GTypeInfo response_info = { + sizeof (LassoEcpResponseClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoEcpResponse), + 0, + NULL, + NULL + }; + + ecp_response_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoEcpResponse", &response_info, 0); + } + return ecp_response_type; +} + + +/** + * lasso_ecp_response_new: + * @AssertionConsumerServiceURL: (allow-none): + * + * Creates and initializes a new #LassoEcpResponse object. + * + * The # object is initialized as follows: + * + * AssertionConsumerServiceURL = @AssertionConsumerServiceURL + * mustUnderstand = TRUE + * actor = #LASSO_SOAP_ENV_ACTOR + * + * + * Returns: a newly created and initialized #LassoEcpResponse object + **/ +LassoNode* +lasso_ecp_response_new(const gchar *AssertionConsumerServiceURL) +{ + LassoEcpResponse *response; + + response = g_object_new(LASSO_TYPE_ECP_RESPONSE, NULL); + + if (AssertionConsumerServiceURL) { + response->AssertionConsumerServiceURL = g_strdup(AssertionConsumerServiceURL); + } + + response->mustUnderstand = TRUE; + response->actor = g_strdup(LASSO_SOAP_ENV_ACTOR); + + return LASSO_NODE(response); +} diff --git a/lasso/xml/ecp/ecp_response.h b/lasso/xml/ecp/ecp_response.h new file mode 100644 index 00000000..430d141d --- /dev/null +++ b/lasso/xml/ecp/ecp_response.h @@ -0,0 +1,69 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef __LASSO_ECP_RESPONSE_H__ +#define __LASSO_ECP_RESPONSE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "../xml.h" + +#define LASSO_TYPE_ECP_RESPONSE (lasso_ecp_response_get_type()) +#define LASSO_ECP_RESPONSE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_ECP_RESPONSE, LassoEcpResponse)) +#define LASSO_ECP_RESPONSE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_ECP_RESPONSE, LassoEcpResponseClass)) +#define LASSO_IS_ECP_RESPONSE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_ECP_RESPONSE)) +#define LASSO_IS_ECP_RESPONSE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_ECP_RESPONSE)) +#define LASSO_ECP_RESPONSE_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_ECP_RESPONSE, LassoEcpResponseClass)) + +typedef struct _LassoEcpResponse LassoEcpResponse; +typedef struct _LassoEcpResponseClass LassoEcpResponseClass; + +struct _LassoEcpResponse { + LassoNode parent; + + gboolean mustUnderstand; + gchar *actor; + gchar *AssertionConsumerServiceURL; +}; + +struct _LassoEcpResponseClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT int lasso_ecp_response_validate(LassoEcpResponse *response); +LASSO_EXPORT GType lasso_ecp_response_get_type(void); +LASSO_EXPORT LassoNode* lasso_ecp_response_new(const gchar *AssertionConsumerServiceURL); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_ECP_RESPONSE_H__ */ diff --git a/lasso/xml/paos_request.c b/lasso/xml/paos_request.c new file mode 100644 index 00000000..731a07e3 --- /dev/null +++ b/lasso/xml/paos_request.c @@ -0,0 +1,221 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "private.h" +#include "paos_request.h" +#include + +/** + * SECTION:paos_request + * @short_description: <paos:Request> + * + *
Schema fragment for paos:Request + * + * + * + * + * + * + * + * + * ]]> + *
+ */ + +/*****************************************************************************/ +/* public methods */ +/*****************************************************************************/ + +/** + * lasso_paos_request_validate: + * @request: The #LassoPaosRequest object to validate + * + * Validates the object conforms to required values. + * + * + * responseConsumerURL must be non-NULL + * mustUnderstand must be TRUE + * actor must be equal to #LASSO_SOAP_ENV_ACTOR + * service must be equal to #LASSO_ECP_HREF + * + * + * Returns: 0 on success, error code otherwise + **/ +int +lasso_paos_request_validate(LassoPaosRequest *request) +{ + g_return_val_if_fail(LASSO_IS_PAOS_REQUEST(request), + LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); + + if (request->responseConsumerURL == NULL) { + error("%s.responseConsumerURL missing", G_OBJECT_CLASS_NAME(request)); + return LASSO_XML_ERROR_ATTR_NOT_FOUND; + } + + if (request->service == NULL) { + error("%s.service missing", G_OBJECT_CLASS_NAME(request)); + return LASSO_XML_ERROR_ATTR_NOT_FOUND; + } + + if (lasso_strisnotequal(request->service, LASSO_ECP_HREF)) { + error("%s.service invalid, must be \"%s\" not \"%s\"", + G_OBJECT_CLASS_NAME(request), LASSO_ECP_HREF, request->service); + return LASSO_XML_ERROR_ATTR_VALUE_INVALID; + } + + if (!request->mustUnderstand) { + error("%s.mustUnderstand must be True", G_OBJECT_CLASS_NAME(request)); + return LASSO_XML_ERROR_ATTR_VALUE_INVALID; + } + + if (request->actor == NULL) { + error("%s.actor missing", G_OBJECT_CLASS_NAME(request)); + return LASSO_XML_ERROR_ATTR_NOT_FOUND; + } + + if (lasso_strisnotequal(request->actor, LASSO_SOAP_ENV_ACTOR)) { + error("%s.actor invalid, must be \"%s\" not \"%s\"", + G_OBJECT_CLASS_NAME(request), LASSO_SOAP_ENV_ACTOR, request->actor); + return LASSO_XML_ERROR_ATTR_VALUE_INVALID; + } + + return 0; +} + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "responseConsumerURL", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoPaosRequest, responseConsumerURL), NULL, NULL, NULL}, + { "service", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoPaosRequest, service), NULL, NULL, NULL}, + { "messageID", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoPaosRequest, messageID), NULL, NULL, NULL}, + { "mustUnderstand", SNIPPET_ATTRIBUTE | SNIPPET_BOOLEAN, + G_STRUCT_OFFSET(LassoPaosRequest, mustUnderstand), NULL, LASSO_SOAP_ENV_PREFIX, LASSO_SOAP_ENV_HREF}, + { "actor", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoPaosRequest, actor), NULL, LASSO_SOAP_ENV_PREFIX, LASSO_SOAP_ENV_HREF}, + {NULL, 0, 0, NULL, NULL, NULL} +}; + +static LassoNodeClass *parent_class = NULL; + + +static int +init_from_xml(LassoNode *node, xmlNode *xmlnode) +{ + lasso_error_t rc = 0; + LassoPaosRequest *request = LASSO_PAOS_REQUEST(node); + + lasso_check_good_rc(parent_class->init_from_xml(node, xmlnode)); + lasso_check_good_rc(lasso_paos_request_validate(request)); + + cleanup: + return rc; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + + +static void +class_init(LassoPaosRequestClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + parent_class = g_type_class_peek_parent(klass); + nclass->node_data = g_new0(LassoNodeClassData, 1); + nclass->init_from_xml = init_from_xml; + lasso_node_class_set_nodename(nclass, "Request"); + lasso_node_class_set_ns(nclass, LASSO_PAOS_HREF, LASSO_PAOS_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); + +} + +GType +lasso_paos_request_get_type() +{ + static GType paos_request_type = 0; + + if (!paos_request_type) { + static const GTypeInfo request_info = { + sizeof (LassoPaosRequestClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoPaosRequest), + 0, + NULL, + NULL + }; + + paos_request_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoPaosRequest", &request_info, 0); + } + return paos_request_type; +} + + +/** + * lasso_paos_request_new: + * @responseConsumerURL: (allow-none): + * @messageID: (allow-none): + * + * The #LassoPaosRequest object is initialized as follows: + * + * responseConsumerURL = @responseConsumerURL (if non-NULL) + * messageID = @messageID (if non-NULL) otherwise generated unique id + * mustUnderstand = TRUE + * actor = #LASSO_SOAP_ENV_ACTOR + * service = #LASSO_ECP_HREF + * + * + * Returns: newly created & initialized #LassoPaosRequest object + **/ +LassoNode* +lasso_paos_request_new(const gchar *responseConsumerURL, const gchar *messageID) +{ + LassoPaosRequest *request; + + request = g_object_new(LASSO_TYPE_PAOS_REQUEST, NULL); + + if (responseConsumerURL) { + request->responseConsumerURL = g_strdup(responseConsumerURL); + } + + if (messageID) { + request->messageID = g_strdup(messageID); + } else { + request->messageID = lasso_build_unique_id(32); + } + + request->mustUnderstand = TRUE; + request->actor = g_strdup(LASSO_SOAP_ENV_ACTOR); + request->service = g_strdup(LASSO_ECP_HREF); + + return LASSO_NODE(request); +} diff --git a/lasso/xml/paos_request.h b/lasso/xml/paos_request.h new file mode 100644 index 00000000..1f15289a --- /dev/null +++ b/lasso/xml/paos_request.h @@ -0,0 +1,69 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef __LASSO_PAOS_REQUEST_H__ +#define __LASSO_PAOS_REQUEST_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define LASSO_TYPE_PAOS_REQUEST (lasso_paos_request_get_type()) +#define LASSO_PAOS_REQUEST(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_PAOS_REQUEST, LassoPaosRequest)) +#define LASSO_PAOS_REQUEST_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_PAOS_REQUEST, LassoPaosRequestClass)) +#define LASSO_IS_PAOS_REQUEST(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_PAOS_REQUEST)) +#define LASSO_IS_PAOS_REQUEST_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_PAOS_REQUEST)) +#define LASSO_PAOS_REQUEST_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_PAOS_REQUEST, LassoPaosRequestClass)) + +typedef struct _LassoPaosRequest LassoPaosRequest; +typedef struct _LassoPaosRequestClass LassoPaosRequestClass; + +struct _LassoPaosRequest { + LassoNode parent; + + gchar *responseConsumerURL; + gchar *messageID; + gchar *service; + gboolean mustUnderstand; + gchar *actor; +}; + +struct _LassoPaosRequestClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT int lasso_paos_request_validate(LassoPaosRequest *node); +LASSO_EXPORT GType lasso_paos_request_get_type(void); +LASSO_EXPORT LassoNode* lasso_paos_request_new(const gchar *responseConsumerURL, const gchar *messageID); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_PAOS_REQUEST_H__ */ diff --git a/lasso/xml/paos_response.c b/lasso/xml/paos_response.c new file mode 100644 index 00000000..6d57d805 --- /dev/null +++ b/lasso/xml/paos_response.c @@ -0,0 +1,190 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "private.h" +#include "paos_response.h" +#include + +/** + * SECTION:paos_response + * @short_description: <paos:Response> + * + *
Schema fragment for paos:Response + * + * + * + * + * + * + * ]]> + *
+ */ + +/*****************************************************************************/ +/* public methods */ +/*****************************************************************************/ + +/** + * lasso_paos_response_validate: + * @response: The #LassoPaosResponse object to validate + * + * Validates the object conforms to required values. + * + * + * mustUnderstand must be TRUE + * actor must be equal to #LASSO_SOAP_ENV_ACTOR + * + * + * Returns: 0 on success, error code otherwise + **/ +int +lasso_paos_response_validate(LassoPaosResponse *response) +{ + g_return_val_if_fail(LASSO_IS_PAOS_RESPONSE(response), + LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); + + if (!response->mustUnderstand) { + error("%s.mustUnderstand must be True", G_OBJECT_CLASS_NAME(response)); + return LASSO_XML_ERROR_ATTR_VALUE_INVALID; + } + + if (response->actor == NULL) { + error("%s.actor missing", G_OBJECT_CLASS_NAME(response)); + return LASSO_XML_ERROR_ATTR_NOT_FOUND; + } + + if (lasso_strisnotequal(response->actor, LASSO_SOAP_ENV_ACTOR)) { + error("%s.actor invalid, must be \"%s\" not \"%s\"", + G_OBJECT_CLASS_NAME(response), + LASSO_SOAP_ENV_ACTOR, response->actor); + return LASSO_XML_ERROR_ATTR_VALUE_INVALID; + } + + return 0; +} + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "refToMessageID", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoPaosResponse, refToMessageID), NULL, NULL, NULL}, + { "mustUnderstand", SNIPPET_ATTRIBUTE | SNIPPET_BOOLEAN, + G_STRUCT_OFFSET(LassoPaosResponse, mustUnderstand), NULL, LASSO_SOAP_ENV_PREFIX, LASSO_SOAP_ENV_HREF}, + { "actor", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoPaosResponse, actor), NULL, LASSO_SOAP_ENV_PREFIX, LASSO_SOAP_ENV_HREF}, + {NULL, 0, 0, NULL, NULL, NULL} +}; + +static LassoNodeClass *parent_class = NULL; + + +static int +init_from_xml(LassoNode *node, xmlNode *xmlnode) +{ + lasso_error_t rc = 0; + LassoPaosResponse *response = LASSO_PAOS_RESPONSE(node); + + lasso_check_good_rc(parent_class->init_from_xml(node, xmlnode)); + lasso_check_good_rc(lasso_paos_response_validate(response)); + + cleanup: + return rc; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + + +static void +class_init(LassoPaosResponseClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + parent_class = g_type_class_peek_parent(klass); + nclass->node_data = g_new0(LassoNodeClassData, 1); + nclass->init_from_xml = init_from_xml; + lasso_node_class_set_nodename(nclass, "Response"); + lasso_node_class_set_ns(nclass, LASSO_PAOS_HREF, LASSO_PAOS_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); + +} + +GType +lasso_paos_response_get_type() +{ + static GType paos_response_type = 0; + + if (!paos_response_type) { + static const GTypeInfo response_info = { + sizeof (LassoPaosResponseClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoPaosResponse), + 0, + NULL, + NULL + }; + + paos_response_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoPaosResponse", &response_info, 0); + } + return paos_response_type; +} + + +/** + * lasso_paos_response_new: + * @refToMessageID: (allow-none): + * + * The #LassoPaosResponse object is initialized as follows: + * + * refToMessageID = @refToMessageID (if non-NULL) + * mustUnderstand = TRUE + * actor = #LASSO_SOAP_ENV_ACTOR + * + * + * Return value: a newly created and initialized #LassoPaosResponse object + **/ +LassoNode* +lasso_paos_response_new(const char *refToMessageID) +{ + LassoPaosResponse *response; + + response = g_object_new(LASSO_TYPE_PAOS_RESPONSE, NULL); + + if (refToMessageID) { + response->refToMessageID = g_strdup(refToMessageID); + } + + response->mustUnderstand = TRUE; + response->actor = g_strdup(LASSO_SOAP_ENV_ACTOR); + + return LASSO_NODE(response); +} diff --git a/lasso/xml/paos_response.h b/lasso/xml/paos_response.h new file mode 100644 index 00000000..0a5ac2a0 --- /dev/null +++ b/lasso/xml/paos_response.h @@ -0,0 +1,67 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef __LASSO_PAOS_RESPONSE_H__ +#define __LASSO_PAOS_RESPONSE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define LASSO_TYPE_PAOS_RESPONSE (lasso_paos_response_get_type()) +#define LASSO_PAOS_RESPONSE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_PAOS_RESPONSE, LassoPaosResponse)) +#define LASSO_PAOS_RESPONSE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_PAOS_RESPONSE, LassoPaosResponseClass)) +#define LASSO_IS_PAOS_RESPONSE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_PAOS_RESPONSE)) +#define LASSO_IS_PAOS_RESPONSE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_PAOS_RESPONSE)) +#define LASSO_PAOS_RESPONSE_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_PAOS_RESPONSE, LassoPaosResponseClass)) + +typedef struct _LassoPaosResponse LassoPaosResponse; +typedef struct _LassoPaosResponseClass LassoPaosResponseClass; + +struct _LassoPaosResponse { + LassoNode parent; + + gchar *refToMessageID; + gboolean mustUnderstand; + gchar *actor; +}; + +struct _LassoPaosResponseClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT int lasso_paos_response_validate(LassoPaosResponse *node); +LASSO_EXPORT GType lasso_paos_response_get_type(void); +LASSO_EXPORT LassoNode* lasso_paos_response_new(const gchar *refToMessageID); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_PAOS_RESPONSE_H__ */ diff --git a/lasso/xml/strings.h b/lasso/xml/strings.h index 14380535..e0de9188 100644 --- a/lasso/xml/strings.h +++ b/lasso/xml/strings.h @@ -941,13 +941,13 @@ /** * LASSO_PAOS_PREFIX: * - * Preferred prefix for namespace of FIXME + * URN binding name for PAOS * */ #define LASSO_PAOS_PREFIX "paos" /*****************************************************************************/ -/* ECP BINDING */ +/* ECP PROFILE */ /*****************************************************************************/ /** @@ -960,7 +960,7 @@ /** * LASSO_ECP_PREFIX: * - * Preferred prefix for namespace of FIXME + * SAML 2 URN profile name for Enhanced Client & Proxy (ECP) * */ #define LASSO_ECP_PREFIX "ecp" @@ -986,4 +986,3 @@ #define LASSO_XSI_PREFIX "xsi" #endif /* __LASSO_STRINGS_H__ */ -