From 5bf0a68bfa6becc803fe42b07eb94fe717c1cc78 Mon Sep 17 00:00:00 2001 From: nobody Date: Wed, 8 Mar 2006 12:13:11 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'rel-0-6-4'. --- lasso/Attic/protocols/.cvsignore | 7 - lasso/Attic/protocols/Makefile.am | 54 -- lasso/Attic/protocols/artifact.c | 371 --------- lasso/Attic/protocols/artifact.h | 87 --- lasso/Attic/protocols/authn_request.c | 381 --------- lasso/Attic/protocols/authn_request.h | 79 -- .../Attic/protocols/authn_request_envelope.c | 136 ---- .../Attic/protocols/authn_request_envelope.h | 72 -- lasso/Attic/protocols/authn_response.c | 194 ----- lasso/Attic/protocols/authn_response.h | 70 -- .../Attic/protocols/authn_response_envelope.c | 159 ---- .../Attic/protocols/authn_response_envelope.h | 72 -- lasso/Attic/protocols/elements/.cvsignore | 6 - lasso/Attic/protocols/elements/Makefile.am | 18 - lasso/Attic/protocols/elements/assertion.c | 102 --- lasso/Attic/protocols/elements/assertion.h | 64 -- .../elements/authentication_statement.c | 149 ---- .../elements/authentication_statement.h | 65 -- lasso/Attic/protocols/federation.c | 360 --------- lasso/Attic/protocols/federation.h | 111 --- .../federation_termination_notification.c | 262 ------- .../federation_termination_notification.h | 71 -- lasso/Attic/protocols/logout_request.c | 303 -------- lasso/Attic/protocols/logout_request.h | 71 -- lasso/Attic/protocols/logout_response.c | 352 --------- lasso/Attic/protocols/logout_response.h | 71 -- .../name_identifier_mapping_request.c | 196 ----- .../name_identifier_mapping_request.h | 72 -- .../name_identifier_mapping_response.c | 228 ------ .../name_identifier_mapping_response.h | 74 -- lasso/Attic/protocols/protocols.c | 26 - lasso/Attic/protocols/protocols.h | 39 - lasso/Attic/protocols/provider.c | 732 ------------------ lasso/Attic/protocols/provider.h | 157 ---- .../register_name_identifier_request.c | 356 --------- .../register_name_identifier_request.h | 78 -- .../register_name_identifier_response.c | 322 -------- .../register_name_identifier_response.h | 74 -- lasso/Attic/protocols/request.c | 145 ---- lasso/Attic/protocols/request.h | 66 -- lasso/Attic/protocols/response.c | 143 ---- lasso/Attic/protocols/response.h | 66 -- 42 files changed, 6461 deletions(-) delete mode 100644 lasso/Attic/protocols/.cvsignore delete mode 100644 lasso/Attic/protocols/Makefile.am delete mode 100644 lasso/Attic/protocols/artifact.c delete mode 100644 lasso/Attic/protocols/artifact.h delete mode 100644 lasso/Attic/protocols/authn_request.c delete mode 100644 lasso/Attic/protocols/authn_request.h delete mode 100644 lasso/Attic/protocols/authn_request_envelope.c delete mode 100644 lasso/Attic/protocols/authn_request_envelope.h delete mode 100644 lasso/Attic/protocols/authn_response.c delete mode 100644 lasso/Attic/protocols/authn_response.h delete mode 100644 lasso/Attic/protocols/authn_response_envelope.c delete mode 100644 lasso/Attic/protocols/authn_response_envelope.h delete mode 100644 lasso/Attic/protocols/elements/.cvsignore delete mode 100644 lasso/Attic/protocols/elements/Makefile.am delete mode 100644 lasso/Attic/protocols/elements/assertion.c delete mode 100644 lasso/Attic/protocols/elements/assertion.h delete mode 100644 lasso/Attic/protocols/elements/authentication_statement.c delete mode 100644 lasso/Attic/protocols/elements/authentication_statement.h delete mode 100644 lasso/Attic/protocols/federation.c delete mode 100644 lasso/Attic/protocols/federation.h delete mode 100644 lasso/Attic/protocols/federation_termination_notification.c delete mode 100644 lasso/Attic/protocols/federation_termination_notification.h delete mode 100644 lasso/Attic/protocols/logout_request.c delete mode 100644 lasso/Attic/protocols/logout_request.h delete mode 100644 lasso/Attic/protocols/logout_response.c delete mode 100644 lasso/Attic/protocols/logout_response.h delete mode 100644 lasso/Attic/protocols/name_identifier_mapping_request.c delete mode 100644 lasso/Attic/protocols/name_identifier_mapping_request.h delete mode 100644 lasso/Attic/protocols/name_identifier_mapping_response.c delete mode 100644 lasso/Attic/protocols/name_identifier_mapping_response.h delete mode 100644 lasso/Attic/protocols/protocols.c delete mode 100644 lasso/Attic/protocols/protocols.h delete mode 100644 lasso/Attic/protocols/provider.c delete mode 100644 lasso/Attic/protocols/provider.h delete mode 100644 lasso/Attic/protocols/register_name_identifier_request.c delete mode 100644 lasso/Attic/protocols/register_name_identifier_request.h delete mode 100644 lasso/Attic/protocols/register_name_identifier_response.c delete mode 100644 lasso/Attic/protocols/register_name_identifier_response.h delete mode 100644 lasso/Attic/protocols/request.c delete mode 100644 lasso/Attic/protocols/request.h delete mode 100644 lasso/Attic/protocols/response.c delete mode 100644 lasso/Attic/protocols/response.h diff --git a/lasso/Attic/protocols/.cvsignore b/lasso/Attic/protocols/.cvsignore deleted file mode 100644 index 672b6184..00000000 --- a/lasso/Attic/protocols/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile -Makefile.in -*.loT -*.lo -*.la -.deps -.libs diff --git a/lasso/Attic/protocols/Makefile.am b/lasso/Attic/protocols/Makefile.am deleted file mode 100644 index 96aaef78..00000000 --- a/lasso/Attic/protocols/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -SUBDIRS = elements - -liblassoincludedir = $(includedir)/lasso/protocols - -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/lasso \ - $(LASSO_DEFINES) \ - $(LASSO_CFLAGS) \ - -DG_LOG_DOMAIN=\"lasso\" - -noinst_LTLIBRARIES = liblasso-protocols.la - -liblasso_protocols_la_LIBADD = \ - $(top_builddir)/lasso/protocols/elements/liblasso-elements.la \ - $(LASSO_LIBS) - -liblasso_protocols_la_SOURCES = \ - protocols.c \ - artifact.c \ - authn_request.c \ - authn_request_envelope.c \ - authn_response.c \ - authn_response_envelope.c \ - federation.c \ - federation_termination_notification.c \ - logout_request.c \ - logout_response.c \ - name_identifier_mapping_request.c \ - name_identifier_mapping_response.c \ - provider.c \ - register_name_identifier_request.c \ - register_name_identifier_response.c \ - request.c \ - response.c - -liblassoinclude_HEADERS = \ - protocols.h \ - artifact.h \ - authn_request.h \ - authn_request_envelope.h \ - authn_response.h \ - authn_response_envelope.h \ - federation.h \ - federation_termination_notification.h \ - logout_request.h \ - logout_response.h \ - name_identifier_mapping_request.h \ - name_identifier_mapping_response.h \ - provider.h \ - register_name_identifier_request.h \ - register_name_identifier_response.h \ - request.h \ - response.h diff --git a/lasso/Attic/protocols/artifact.c b/lasso/Attic/protocols/artifact.c deleted file mode 100644 index 2a9c9881..00000000 --- a/lasso/Attic/protocols/artifact.c +++ /dev/null @@ -1,371 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include - -/*****************************************************************************/ -/* functions */ -/*****************************************************************************/ - -static gint -lasso_artifact_split_samlArt(gchar *b64_samlArt, - gchar *byteCode, - gchar *identityProviderSuccinctID, - gchar *assertionHandle) -{ - xmlSecByte samlArt[42+1]; - gint i, j, byte_code = 0; - - /* decode samlArt */ - i = xmlSecBase64Decode(b64_samlArt, samlArt, 42+1); - if (i < 0 || i > 42) { - return -1; - } - /* extract ByteCode, IdentityProviderSuccinctID and AssertionHandle */ - for(j=0; j<42; j++) { - if (j < 2) { - byte_code += (guint)samlArt[j]; - } - else if (j >= 2 && j < 22) { - identityProviderSuccinctID[j-2] = samlArt[j]; - } - else if (j >= 22) { - assertionHandle[j-22] = samlArt[j]; - } - } - sprintf(byteCode, "%d", byte_code); - - return 0; -} - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -xmlChar* -lasso_artifact_get_assertionHandle(LassoArtifact *artifact, - GError **err) -{ - xmlChar *assertionHandle; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - if (LASSO_IS_ARTIFACT(artifact) == FALSE) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ, - lasso_strerror(LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ)); - g_return_val_if_fail(LASSO_IS_ARTIFACT(artifact), NULL); - } - - assertionHandle = lasso_node_get_child_content(LASSO_NODE(artifact), - "AssertionHandle", - NULL, &tmp_err); - if (assertionHandle == NULL) { - g_propagate_error (err, tmp_err); - } - - return assertionHandle; -} - -/** - * lasso_artifact_get_byteCode: - * @artifact: an LassoArtifact - * @err: return location for an allocated GError, or NULL to ignore errors - * - * Gets the ByteCode of the artifact - * - * Return value: the ByteCode or a negative integer if an error occurs. - **/ -gint -lasso_artifact_get_byteCode(LassoArtifact *artifact, - GError **err) -{ - xmlChar *byteCode; - gint ret; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, - LASSO_PARAM_ERROR_CHECK_FAILED); - } - if (LASSO_IS_ARTIFACT(artifact) == FALSE) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ, - lasso_strerror(LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ)); - g_return_val_if_fail(LASSO_IS_ARTIFACT(artifact), - LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ); - } - - byteCode = lasso_node_get_child_content(LASSO_NODE(artifact), - "ByteCode", NULL, &tmp_err); - if (byteCode == NULL) { - g_propagate_error (err, tmp_err); - return -1; - } - - ret = (gint)g_strtod(byteCode, NULL); - xmlFree(byteCode); - - return ret; -} - -xmlChar* -lasso_artifact_get_b64IdentityProviderSuccinctID(LassoArtifact *artifact, - GError **err) -{ - xmlChar *b64_identityProviderSuccinctID; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - if (LASSO_IS_ARTIFACT(artifact) == FALSE) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ, - lasso_strerror(LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ)); - g_return_val_if_fail(LASSO_IS_ARTIFACT(artifact), NULL); - } - - b64_identityProviderSuccinctID = lasso_node_get_child_content(LASSO_NODE(artifact), - "B64IdentityProviderSuccinctID", - NULL, &tmp_err); - if (b64_identityProviderSuccinctID == NULL) { - g_propagate_error (err, tmp_err); - } - - return b64_identityProviderSuccinctID; -} - -xmlChar* -lasso_artifact_get_relayState(LassoArtifact *artifact, - GError **err) -{ - xmlChar *relayState; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - if (LASSO_IS_ARTIFACT(artifact) == FALSE) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ, - lasso_strerror(LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ)); - g_return_val_if_fail(LASSO_IS_ARTIFACT(artifact), NULL); - } - - relayState = lasso_node_get_child_content(LASSO_NODE(artifact), - "RelayState", NULL, &tmp_err); - if (relayState == NULL) { - g_propagate_error (err, tmp_err); - } - - return relayState; -} - -xmlChar* -lasso_artifact_get_samlArt(LassoArtifact *artifact, - GError **err) -{ - xmlChar *samlArt; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - if (LASSO_IS_ARTIFACT(artifact) == FALSE) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ, - lasso_strerror(LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ)); - g_return_val_if_fail(LASSO_IS_ARTIFACT(artifact), NULL); - } - - samlArt = lasso_node_get_child_content(LASSO_NODE(artifact), - "SAMLart", NULL, &tmp_err); - if (samlArt == NULL) { - g_propagate_error (err, tmp_err); - } - - return samlArt; -} - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_artifact_instance_init(LassoArtifact *artifact) -{ - LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(artifact)); - - class->set_name(LASSO_NODE(artifact), "Artifact"); -} - -static void -lasso_artifact_class_init(LassoArtifactClass *class) -{ -} - -GType lasso_artifact_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoArtifactClass), - NULL, - NULL, - (GClassInitFunc) lasso_artifact_class_init, - NULL, - NULL, - sizeof(LassoArtifact), - 0, - (GInstanceInitFunc) lasso_artifact_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_NODE, - "LassoArtifact", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_artifact_new(gchar *samlArt, - gchar *byteCode, - gchar *identityProviderSuccinctID, - gchar *assertionHandle, - gchar *relayState) -{ - LassoNode *artifact; - LassoNodeClass *class; - xmlChar *b64_identityProviderSuccinctID; - - g_return_val_if_fail(byteCode != NULL, NULL); - g_return_val_if_fail(identityProviderSuccinctID != NULL, NULL); - g_return_val_if_fail(assertionHandle != NULL, NULL); - - artifact = LASSO_NODE(g_object_new(LASSO_TYPE_ARTIFACT, NULL)); - - class = LASSO_NODE_GET_CLASS(artifact); - class->new_child(artifact, "SAMLart", samlArt, FALSE); - class->new_child(artifact, "ByteCode", byteCode, FALSE); - b64_identityProviderSuccinctID = xmlSecBase64Encode(identityProviderSuccinctID, - 20, 0); - class->new_child(artifact, "B64IdentityProviderSuccinctID", - b64_identityProviderSuccinctID, FALSE); - xmlFree(b64_identityProviderSuccinctID); - class->new_child(artifact, "AssertionHandle", assertionHandle, FALSE); - if (relayState != NULL) { - class->new_child(artifact, "RelayState", relayState, FALSE); - } - - return artifact; -} - -LassoNode* -lasso_artifact_new_from_query(const xmlChar *query) -{ - LassoNode *artifact = NULL; - GData *gd; - gchar *b64_samlArt, *relayState; - gchar *byteCode, *identityProviderSuccinctID, *assertionHandle; - gint ret; - - g_return_val_if_fail(query != NULL, NULL); - - - gd = lasso_query_to_dict(query); - b64_samlArt = g_strdup(lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "SAMLart"), 0)); - relayState = g_strdup(lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "RelayState"), 0)); - g_datalist_clear(&gd); - - byteCode = (gchar *) g_new0(gchar, 5+1); - identityProviderSuccinctID = (gchar *) g_new0(gchar, 21); - assertionHandle = (gchar *) g_new0(gchar, 20+1); - ret = lasso_artifact_split_samlArt((gchar*)b64_samlArt, byteCode, - identityProviderSuccinctID, - assertionHandle); - - if (ret >= 0) { - artifact = lasso_artifact_new(b64_samlArt, - byteCode, identityProviderSuccinctID, - assertionHandle, - relayState); - } - g_free(byteCode); - g_free(identityProviderSuccinctID); - g_free(assertionHandle); - g_free(b64_samlArt); - g_free(relayState); - - return artifact; -} - -LassoNode* -lasso_artifact_new_from_lares(const xmlChar *lares, - const xmlChar *relayState) -{ - LassoNode *artifact = NULL; - gchar *byteCode, *identityProviderSuccinctID, *assertionHandle; - gint ret; - - g_return_val_if_fail(lares != NULL, NULL); - - byteCode = g_new0(gchar, 5+1); - identityProviderSuccinctID = (gchar *) g_new0(gchar, 20); - assertionHandle = (gchar *) g_new0(gchar, 20+1); - ret = lasso_artifact_split_samlArt((gchar*)lares, byteCode, - identityProviderSuccinctID, - assertionHandle); - if (ret >= 0) { - artifact = lasso_artifact_new((gchar*)lares, - byteCode, identityProviderSuccinctID, - assertionHandle, - (gchar*)relayState); - } - g_free(byteCode); - g_free(identityProviderSuccinctID); - g_free(assertionHandle); - - return artifact; -} diff --git a/lasso/Attic/protocols/artifact.h b/lasso/Attic/protocols/artifact.h deleted file mode 100644 index 69f8a361..00000000 --- a/lasso/Attic/protocols/artifact.h +++ /dev/null @@ -1,87 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_ARTIFACT_H__ -#define __LASSO_ARTIFACT_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include - -#define LASSO_TYPE_ARTIFACT (lasso_artifact_get_type()) -#define LASSO_ARTIFACT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_ARTIFACT, LassoArtifact)) -#define LASSO_ARTIFACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_ARTIFACT, LassoArtifactClass)) -#define LASSO_IS_ARTIFACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_ARTIFACT)) -#define LASSO_IS_ARTIFACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_ARTIFACT)) -#define LASSO_ARTIFACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_ARTIFACT, LassoArtifactClass)) - -typedef struct _LassoArtifact LassoArtifact; -typedef struct _LassoArtifactClass LassoArtifactClass; - -struct _LassoArtifact { - LassoNode parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoArtifactClass { - LassoNodeClass parent; -}; - -LASSO_EXPORT GType lasso_artifact_get_type (void); - -LASSO_EXPORT LassoNode* lasso_artifact_new (gchar *samlArt, - gchar *byteCode, - gchar *identityProviderSuccinctID, - gchar *assertionHandle, - gchar *relayState); - -LASSO_EXPORT LassoNode* lasso_artifact_new_from_query (const xmlChar *query); - -LASSO_EXPORT LassoNode* lasso_artifact_new_from_lares (const xmlChar *lares, - const xmlChar *relayState); - -LASSO_EXPORT xmlChar* lasso_artifact_get_assertionHandle (LassoArtifact *artifact, - GError **err); - -LASSO_EXPORT gint lasso_artifact_get_byteCode (LassoArtifact *artifact, - GError **err); - -LASSO_EXPORT xmlChar* lasso_artifact_get_b64IdentityProviderSuccinctID (LassoArtifact *artifact, - GError **err); - -LASSO_EXPORT xmlChar* lasso_artifact_get_relayState (LassoArtifact *artifact, - GError **err); - -LASSO_EXPORT xmlChar* lasso_artifact_get_samlArt (LassoArtifact *artifact, - GError **err); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_ARTIFACT_H__ */ diff --git a/lasso/Attic/protocols/authn_request.c b/lasso/Attic/protocols/authn_request.c deleted file mode 100644 index c5e3585d..00000000 --- a/lasso/Attic/protocols/authn_request.c +++ /dev/null @@ -1,381 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include - -/*****************************************************************************/ -/* functions */ -/*****************************************************************************/ - -gchar * -lasso_authn_request_get_protocolProfile(gchar *query) -{ - gchar *protocolProfile; - - protocolProfile = lasso_g_ptr_array_index(lasso_query_get_value(query, "ProtocolProfile"), 0); - if (protocolProfile == NULL) - protocolProfile = (gchar *)lassoLibProtocolProfileBrwsArt; - - return protocolProfile; -} - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -void -lasso_authn_request_set_requestAuthnContext(LassoAuthnRequest *request, - GPtrArray *authnContextClassRefs, - GPtrArray *authnContextStatementRefs, - const xmlChar *authnContextComparison) -{ - LassoNode *request_authn_context; - gint i; - - g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request)); - - /* - all arguments are optional - however, we need at least one to create the RequestAuthnContext element - */ - if (authnContextClassRefs || authnContextStatementRefs || authnContextComparison) { - /* ok, we create a new RequestAuthnContext instance */ - request_authn_context = lasso_lib_request_authn_context_new(); - /* AuthnContextClassRefs */ - if (authnContextClassRefs != NULL) { - if (authnContextClassRefs->len > 0) { - for(i=0; ilen; i++) { - lasso_lib_request_authn_context_add_authnContextClassRef(LASSO_LIB_REQUEST_AUTHN_CONTEXT(request_authn_context), - lasso_g_ptr_array_index(authnContextClassRefs, i)); - } - } - } - /* AuthnContextStatementRefs */ - if (authnContextStatementRefs != NULL) { - if (authnContextStatementRefs->len > 0) { - for(i=0; ilen; i++) { - lasso_lib_request_authn_context_add_authnContextStatementRef(LASSO_LIB_REQUEST_AUTHN_CONTEXT(request_authn_context), - lasso_g_ptr_array_index(authnContextStatementRefs, i)); - } - } - } - /* AuthnContextComparison */ - if (authnContextComparison != NULL) { - lasso_lib_request_authn_context_set_authnContextComparison(LASSO_LIB_REQUEST_AUTHN_CONTEXT(request_authn_context), - authnContextComparison); - } - /* Add RequestAuthnContext in AuthnRequest */ - lasso_lib_authn_request_set_requestAuthnContext(LASSO_LIB_AUTHN_REQUEST(request), - LASSO_LIB_REQUEST_AUTHN_CONTEXT(request_authn_context)); - lasso_node_destroy(request_authn_context); - } -} - -void -lasso_authn_request_set_scoping(LassoAuthnRequest *request, - gint proxyCount) -{ - LassoNode *scoping; - - g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request)); - - /* create a new Scoping instance */ - scoping = lasso_lib_scoping_new(); - /* ProxyCount */ - lasso_lib_scoping_set_proxyCount(LASSO_LIB_SCOPING(scoping), proxyCount); - /* FIXME : set IDPList here */ - lasso_lib_authn_request_set_scoping(LASSO_LIB_AUTHN_REQUEST(request), - LASSO_LIB_SCOPING(scoping)); - lasso_node_destroy(scoping); -} - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_authn_request_instance_init(LassoAuthnRequest *request) -{ -} - -static void -lasso_authn_request_class_init(LassoAuthnRequestClass *class) -{ -} - -GType lasso_authn_request_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoAuthnRequestClass), - NULL, - NULL, - (GClassInitFunc) lasso_authn_request_class_init, - NULL, - NULL, - sizeof(LassoAuthnRequest), - 0, - (GInstanceInitFunc) lasso_authn_request_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_AUTHN_REQUEST, - "LassoAuthnRequest", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_authn_request_new(const xmlChar *providerID, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method) -{ - LassoNode *request; - xmlChar *id, *time; - - request = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHN_REQUEST, NULL)); - - /* Set ONLY required elements/attributes */ - /* RequestID */ - id = lasso_build_unique_id(32); - lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), - id); - xmlFree(id); - /* MajorVersion */ - lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMajorVersion); - /* MinorVersion */ - lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMinorVersion); - /* IssueInstant */ - time = lasso_get_current_time(); - lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request), - time); - xmlFree(time); - /* Signature template */ - if (sign_type != lassoSignatureTypeNone) { - lasso_samlp_request_abstract_set_signature_tmpl(LASSO_SAMLP_REQUEST_ABSTRACT(request), - sign_type, - sign_method, - NULL); - } - /* ProviderID */ - lasso_lib_authn_request_set_providerID(LASSO_LIB_AUTHN_REQUEST(request), - providerID); - - return request; -} - -LassoNode* -lasso_authn_request_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *request = NULL, *authn_context = NULL, *scoping; - LassoNode *request_node, *soap_node; - GData *gd; - xmlChar *str, *buffer_decoded; - gchar *export; - GPtrArray *array; - gint i; - - g_return_val_if_fail(buffer != NULL, NULL); - - request = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHN_REQUEST, NULL)); - - switch (export_type) { - case lassoNodeExportTypeXml: - lasso_node_import(request, buffer); - break; - case lassoNodeExportTypeQuery: - gd = lasso_query_to_dict(buffer); - if (gd == NULL) { - g_object_unref(request); - return NULL; - } - - /* RequestID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "RequestID"), 0); - if (str != NULL) - lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), - str); - else { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - - /* MajorVersion */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MajorVersion"), 0); - if (str != NULL) - lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - str); - else - lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMajorVersion); - - /* MinorVersion */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MinorVersion"), 0); - if (str != NULL) - lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - str); - else - lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMinorVersion); - - /* IssueInstant */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "IssueInstant"), 0); - if (str != NULL) { - lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request), - str); - } - else { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - - /* ProviderID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "ProviderID"), 0); - if (str != NULL) - lasso_lib_authn_request_set_providerID(LASSO_LIB_AUTHN_REQUEST(request), str); - else { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - - /* NameIDPolicy */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "NameIDPolicy"), 0); - if (str != NULL) - lasso_lib_authn_request_set_nameIDPolicy(LASSO_LIB_AUTHN_REQUEST(request), str); - - /* ForceAuthn */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "ForceAuthn"), 0); - if (str != NULL){ - if(!strcmp(str, "true")) - lasso_lib_authn_request_set_forceAuthn(LASSO_LIB_AUTHN_REQUEST(request), TRUE); - else if(!strcmp(str, "false")) - lasso_lib_authn_request_set_forceAuthn(LASSO_LIB_AUTHN_REQUEST(request), FALSE); - } - - /* IsPassive */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "IsPassive"), 0); - if (str != NULL){ - if(!strcmp(str, "true")) - lasso_lib_authn_request_set_isPassive(LASSO_LIB_AUTHN_REQUEST(request), TRUE); - else - lasso_lib_authn_request_set_isPassive(LASSO_LIB_AUTHN_REQUEST(request), FALSE); - } - - /* ProtocolProfile */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "ProtocolProfile"), 0); - if (str != NULL) - lasso_lib_authn_request_set_protocolProfile(LASSO_LIB_AUTHN_REQUEST(request), str); - - /* AssertionConsumerServiceID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "AssertionConsumerServiceID"), 0); - if (str != NULL) - lasso_lib_authn_request_set_assertionConsumerServiceID(LASSO_LIB_AUTHN_REQUEST(request), str); - - /* AuthnContext */ - array = (GPtrArray *)g_datalist_get_data(&gd, "AuthnContextClassRef"); - if (array != NULL) { - if (authn_context == NULL) - authn_context = lasso_lib_request_authn_context_new(); - for(i=0; ilen; i++) - lasso_lib_request_authn_context_add_authnContextClassRef(LASSO_LIB_REQUEST_AUTHN_CONTEXT(authn_context), - lasso_g_ptr_array_index(array, i)); - } - array = (GPtrArray *)g_datalist_get_data(&gd, "AuthnContextStatementRef"); - if (array != NULL) { - if (authn_context == NULL) - authn_context = lasso_lib_request_authn_context_new(); - for(i=0; ilen; i++) - lasso_lib_request_authn_context_add_authnContextStatementRef(LASSO_LIB_REQUEST_AUTHN_CONTEXT(authn_context), - lasso_g_ptr_array_index(array, i)); - } - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "AuthnContextComparison"), 0); - if (str != NULL) { - if (authn_context == NULL) - authn_context = lasso_lib_request_authn_context_new(); - lasso_lib_request_authn_context_set_authnContextComparison(LASSO_LIB_REQUEST_AUTHN_CONTEXT(authn_context), - str); - } - if (authn_context != NULL) { - lasso_lib_authn_request_set_requestAuthnContext(LASSO_LIB_AUTHN_REQUEST(request), - LASSO_LIB_REQUEST_AUTHN_CONTEXT(authn_context)); - lasso_node_destroy(authn_context); - } - - /* RelayState */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "RelayState"), 0); - if (str != NULL) { - lasso_lib_authn_request_set_relayState(LASSO_LIB_AUTHN_REQUEST(request), str); - } - - /* Scoping - FIXME -> IDPList */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "ProxyCount"), 0); - if (str != NULL) { - /* create a new Scoping instance */ - scoping = lasso_lib_scoping_new(); - /* ProxyCount */ - lasso_lib_scoping_set_proxyCount(LASSO_LIB_SCOPING(scoping), atoi(str)); - lasso_lib_authn_request_set_scoping(LASSO_LIB_AUTHN_REQUEST(request), - LASSO_LIB_SCOPING(scoping)); - lasso_node_destroy(scoping); - } - - /* consent */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "consent"), 0); - if (str != NULL) { - lasso_lib_authn_request_set_consent(LASSO_LIB_AUTHN_REQUEST(request), str); - } - - g_datalist_clear(&gd); - break; - case lassoNodeExportTypeBase64: - buffer_decoded = xmlMalloc(strlen(buffer)); - xmlSecBase64Decode(buffer, buffer_decoded, strlen(buffer)); - lasso_node_import(request, buffer_decoded); - xmlFree(buffer_decoded); - break; - case lassoNodeExportTypeSoap: - soap_node = lasso_node_new_from_dump(buffer); - request_node = lasso_node_get_child(soap_node, "AuthnRequest", - lassoLibHRef, NULL); - export = lasso_node_export(request_node); - lasso_node_import(request, export); - g_free(export); - lasso_node_destroy(request_node); - lasso_node_destroy(soap_node); - break; - } - - return request; -} diff --git a/lasso/Attic/protocols/authn_request.h b/lasso/Attic/protocols/authn_request.h deleted file mode 100644 index 8e05ad16..00000000 --- a/lasso/Attic/protocols/authn_request.h +++ /dev/null @@ -1,79 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_AUTHN_REQUEST_H__ -#define __LASSO_AUTHN_REQUEST_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include - -#define LASSO_TYPE_AUTHN_REQUEST (lasso_authn_request_get_type()) -#define LASSO_AUTHN_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_AUTHN_REQUEST, LassoAuthnRequest)) -#define LASSO_AUTHN_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_AUTHN_REQUEST, LassoAuthnRequestClass)) -#define LASSO_IS_AUTHN_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_AUTHN_REQUEST)) -#define LASSO_IS_AUTHN_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_AUTHN_REQUEST)) -#define LASSO_AUTHN_REQUEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_AUTHN_REQUEST, LassoAuthnRequestClass)) - -typedef struct _LassoAuthnRequest LassoAuthnRequest; -typedef struct _LassoAuthnRequestClass LassoAuthnRequestClass; - -struct _LassoAuthnRequest { - LassoLibAuthnRequest parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoAuthnRequestClass { - LassoLibAuthnRequestClass parent; -}; - -LASSO_EXPORT gchar* lasso_authn_request_get_protocolProfile (gchar *query); - - -LASSO_EXPORT GType lasso_authn_request_get_type (void); - -LASSO_EXPORT LassoNode* lasso_authn_request_new (const xmlChar *providerID, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method); - -LASSO_EXPORT LassoNode* lasso_authn_request_new_from_export (gchar *buffer, - lassoNodeExportType export_type); - -LASSO_EXPORT void lasso_authn_request_set_requestAuthnContext (LassoAuthnRequest *request, - GPtrArray *authnContextClassRefs, - GPtrArray *authnContextStatementRefs, - const xmlChar *authnContextComparison); - -LASSO_EXPORT void lasso_authn_request_set_scoping (LassoAuthnRequest *request, - gint proxyCount); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_AUTHN_REQUEST_H__ */ diff --git a/lasso/Attic/protocols/authn_request_envelope.c b/lasso/Attic/protocols/authn_request_envelope.c deleted file mode 100644 index fb00a3c8..00000000 --- a/lasso/Attic/protocols/authn_request_envelope.c +++ /dev/null @@ -1,136 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include - -#include - -/*****************************************************************************/ -/* functions */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -LassoNode *lasso_authn_request_envelope_get_authnRequest(LassoAuthnRequestEnvelope *request) -{ - g_return_val_if_fail(LASSO_IS_AUTHN_REQUEST_ENVELOPE(request), NULL); - - return lasso_node_get_child(LASSO_NODE(request), "AuthnRequest", NULL, NULL); -} - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_authn_request_envelope_instance_init(LassoAuthnRequestEnvelope *request) -{ -} - -static void -lasso_authn_request_envelope_class_init(LassoAuthnRequestEnvelopeClass *class) -{ -} - -GType lasso_authn_request_envelope_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoAuthnRequestEnvelopeClass), - NULL, - NULL, - (GClassInitFunc) lasso_authn_request_envelope_class_init, - NULL, - NULL, - sizeof(LassoAuthnRequestEnvelope), - 0, - (GInstanceInitFunc) lasso_authn_request_envelope_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_AUTHN_REQUEST_ENVELOPE, - "LassoAuthnRequestEnvelope", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_authn_request_envelope_new(LassoAuthnRequest *authnRequest, - xmlChar *providerID, - xmlChar *assertionConsumerServiceURL) -{ - LassoNode *request; - - g_return_val_if_fail(LASSO_IS_AUTHN_REQUEST(authnRequest), NULL); - g_return_val_if_fail(providerID != NULL, NULL); - g_return_val_if_fail(assertionConsumerServiceURL != NULL, NULL); - - request = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHN_REQUEST_ENVELOPE, NULL)); - - lasso_lib_authn_request_envelope_set_authnRequest(LASSO_LIB_AUTHN_REQUEST_ENVELOPE(request), - LASSO_LIB_AUTHN_REQUEST(authnRequest)); - lasso_lib_authn_request_envelope_set_providerID(LASSO_LIB_AUTHN_REQUEST_ENVELOPE(request), - providerID); - lasso_lib_authn_request_envelope_set_assertionConsumerServiceURL(LASSO_LIB_AUTHN_REQUEST_ENVELOPE(request), - assertionConsumerServiceURL); - - return request; -} - -LassoNode* -lasso_authn_request_envelope_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *request; - xmlChar *buffer_decoded; - - g_return_val_if_fail(buffer != NULL, NULL); - - request = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHN_REQUEST_ENVELOPE, NULL)); - - switch(export_type) { - case lassoNodeExportTypeXml: - lasso_node_import(request, buffer); - break; - case lassoNodeExportTypeBase64: - buffer_decoded = xmlMalloc(strlen(buffer)); - xmlSecBase64Decode(buffer, buffer_decoded, strlen(buffer)); - lasso_node_import(request, buffer_decoded); - xmlFree(buffer_decoded); - break; - default: - message(G_LOG_LEVEL_WARNING, "Invalid export type : %d\n", export_type); - g_free(request); - request = NULL; - break; - } - - return request; -} diff --git a/lasso/Attic/protocols/authn_request_envelope.h b/lasso/Attic/protocols/authn_request_envelope.h deleted file mode 100644 index d48410cc..00000000 --- a/lasso/Attic/protocols/authn_request_envelope.h +++ /dev/null @@ -1,72 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_AUTHN_REQUEST_ENVELOPE_H__ -#define __LASSO_AUTHN_REQUEST_ENVELOPE_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include - - -#define LASSO_TYPE_AUTHN_REQUEST_ENVELOPE (lasso_authn_request_envelope_get_type()) -#define LASSO_AUTHN_REQUEST_ENVELOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_AUTHN_REQUEST_ENVELOPE, LassoAuthnRequestEnvelope)) -#define LASSO_AUTHN_REQUEST_ENVELOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_AUTHN_REQUEST_ENVELOPE, LassoAuthnRequestEnvelopeClass)) -#define LASSO_IS_AUTHN_REQUEST_ENVELOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_AUTHN_REQUEST_ENVELOPE)) -#define LASSO_IS_AUTHN_REQUEST_ENVELOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_AUTHN_REQUEST_ENVELOPE)) -#define LASSO_AUTHN_REQUEST_ENVELOPE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_AUTHN_REQUEST_ENVELOPE, LassoAuthnRequestEnvelopeClass)) - -typedef struct _LassoAuthnRequestEnvelope LassoAuthnRequestEnvelope; -typedef struct _LassoAuthnRequestEnvelopeClass LassoAuthnRequestEnvelopeClass; - -struct _LassoAuthnRequestEnvelope { - LassoLibAuthnRequestEnvelope parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoAuthnRequestEnvelopeClass { - LassoLibAuthnRequestEnvelopeClass parent; -}; - -LASSO_EXPORT GType lasso_authn_request_envelope_get_type (void); - -LASSO_EXPORT LassoNode* lasso_authn_request_envelope_new (LassoAuthnRequest *authnRequest, - xmlChar *providerID, - xmlChar *assertionConsumerServiceURL); - -LASSO_EXPORT LassoNode* lasso_authn_request_envelope_new_from_export (gchar *buffer, - lassoNodeExportType export_type); - -LASSO_EXPORT LassoNode* lasso_authn_request_envelope_get_authnRequest (LassoAuthnRequestEnvelope *request); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_AUTHN_REQUEST_ENVELOPE_H__ */ diff --git a/lasso/Attic/protocols/authn_response.c b/lasso/Attic/protocols/authn_response.c deleted file mode 100644 index 75d5ba12..00000000 --- a/lasso/Attic/protocols/authn_response.c +++ /dev/null @@ -1,194 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include - -static void -lasso_authn_response_set_status(LassoAuthnResponse *response, - const xmlChar *statusCodeValue) { - LassoNode *status, *status_code; - - status = lasso_samlp_status_new(); - - status_code = lasso_samlp_status_code_new(); - lasso_samlp_status_code_set_value(LASSO_SAMLP_STATUS_CODE(status_code), - statusCodeValue); - - lasso_samlp_status_set_statusCode(LASSO_SAMLP_STATUS(status), - LASSO_SAMLP_STATUS_CODE(status_code)); - - lasso_samlp_response_set_status(LASSO_SAMLP_RESPONSE(response), - LASSO_SAMLP_STATUS(status)); - lasso_node_destroy(status_code); - lasso_node_destroy(status); -} - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -xmlChar * -lasso_authn_response_get_status(LassoAuthnResponse *response) { - LassoNode *status_code; - xmlChar *value; - GError *err = NULL; - - status_code = lasso_node_get_child(LASSO_NODE(response), "StatusCode", - NULL, NULL); - if (status_code != NULL) { - value = lasso_node_get_attr_value(status_code, "Value", &err); - lasso_node_destroy(status_code); - if (err != NULL) { - message(G_LOG_LEVEL_WARNING, err->message); - g_error_free(err); - return NULL; - } - else { - return value; - } - } - else { - message(G_LOG_LEVEL_WARNING, "No StatusCode element found in AuthnResponse.\n"); - return NULL; - } -} - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_authn_response_instance_init(LassoAuthnResponse *response) -{ -} - -static void -lasso_authn_response_class_init(LassoAuthnResponseClass *class) -{ -} - -GType lasso_authn_response_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoAuthnResponseClass), - NULL, - NULL, - (GClassInitFunc) lasso_authn_response_class_init, - NULL, - NULL, - sizeof(LassoAuthnResponse), - 0, - (GInstanceInitFunc) lasso_authn_response_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_AUTHN_RESPONSE, - "LassoAuthnResponse", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_authn_response_new(char *providerID, - LassoNode *request) -{ - LassoNode *response; - xmlChar *id, *time, *content; - - g_return_val_if_fail(providerID != NULL, NULL); - - response = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHN_RESPONSE, NULL)); - - /* ResponseID */ - id = lasso_build_unique_id(32); - lasso_samlp_response_abstract_set_responseID(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - id); - xmlFree(id); - - /* MajorVersion */ - lasso_samlp_response_abstract_set_majorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - lassoLibMajorVersion); - - /* MinorVersion */ - lasso_samlp_response_abstract_set_minorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - lassoLibMinorVersion); - - /* IssueInstant */ - time = lasso_get_current_time(); - lasso_samlp_response_abstract_set_issueInstant(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - time); - xmlFree(time); - - /* ProviderID */ - lasso_lib_authn_response_set_providerID(LASSO_LIB_AUTHN_RESPONSE(response), - providerID); - - /* RelayState */ - content = lasso_node_get_child_content(request, "RelayState", lassoLibHRef, NULL); - if (content != NULL) { - lasso_lib_authn_response_set_relayState(LASSO_LIB_AUTHN_RESPONSE(response), - content); - xmlFree(content); - } - - /* Status Code */ - lasso_authn_response_set_status(LASSO_AUTHN_RESPONSE(response), lassoSamlStatusCodeSuccess); - - return response; -} - -LassoNode* -lasso_authn_response_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - xmlChar *buffer_decoded; - LassoNode *response = NULL; - - g_return_val_if_fail(buffer != NULL, NULL); - - response = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHN_RESPONSE, NULL)); - - switch (export_type) { - case lassoNodeExportTypeXml: - lasso_node_import(response, buffer); - break; - case lassoNodeExportTypeBase64: - buffer_decoded = xmlMalloc(strlen(buffer)); - xmlSecBase64Decode(buffer, buffer_decoded, strlen(buffer)); - lasso_node_import(response, buffer_decoded); - xmlFree(buffer_decoded); - break; - case lassoNodeExportTypeQuery: - case lassoNodeExportTypeSoap: - break; - } - - return response; -} diff --git a/lasso/Attic/protocols/authn_response.h b/lasso/Attic/protocols/authn_response.h deleted file mode 100644 index 90eb9144..00000000 --- a/lasso/Attic/protocols/authn_response.h +++ /dev/null @@ -1,70 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_AUTHN_RESPONSE_H__ -#define __LASSO_AUTHN_RESPONSE_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include - -#define LASSO_TYPE_AUTHN_RESPONSE (lasso_authn_response_get_type()) -#define LASSO_AUTHN_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_AUTHN_RESPONSE, LassoAuthnResponse)) -#define LASSO_AUTHN_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_AUTHN_RESPONSE, LassoAuthnResponseClass)) -#define LASSO_IS_AUTHN_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_AUTHN_RESPONSE)) -#define LASSO_IS_AUTHN_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_AUTHN_RESPONSE)) -#define LASSO_AUTHN_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_AUTHN_RESPONSE, LassoAuthnResponseClass)) - -typedef struct _LassoAuthnResponse LassoAuthnResponse; -typedef struct _LassoAuthnResponseClass LassoAuthnResponseClass; - -struct _LassoAuthnResponse { - LassoLibAuthnResponse parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoAuthnResponseClass { - LassoLibAuthnResponseClass parent; -}; - -LASSO_EXPORT GType lasso_authn_response_get_type (void); - -LASSO_EXPORT LassoNode* lasso_authn_response_new (char *providerID, - LassoNode *request); - -LASSO_EXPORT LassoNode* lasso_authn_response_new_from_export (gchar *buffer, - lassoNodeExportType type); - -LASSO_EXPORT xmlChar* lasso_authn_response_get_status (LassoAuthnResponse *response); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_AUTHN_RESPONSE_H__ */ diff --git a/lasso/Attic/protocols/authn_response_envelope.c b/lasso/Attic/protocols/authn_response_envelope.c deleted file mode 100644 index 378f09e6..00000000 --- a/lasso/Attic/protocols/authn_response_envelope.c +++ /dev/null @@ -1,159 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include - -/*****************************************************************************/ -/* functions */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -xmlChar *lasso_authn_response_envelope_get_assertionConsumerServiceURL(LassoAuthnResponseEnvelope *response) -{ - g_return_val_if_fail(LASSO_IS_AUTHN_RESPONSE_ENVELOPE(response), NULL); - - return lasso_node_get_child_content(LASSO_NODE(response), "AssertionConsumerServiceURL", NULL, NULL); -} - -LassoNode* lasso_authn_response_envelope_get_authnResponse(LassoAuthnResponseEnvelope *response) -{ - g_return_val_if_fail(LASSO_IS_AUTHN_RESPONSE_ENVELOPE(response), NULL); - - return lasso_node_get_child(LASSO_NODE(response), "AuthnResponse", NULL, NULL); -} - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_authn_response_envelope_instance_init(LassoAuthnResponseEnvelope *response) -{ -} - -static void -lasso_authn_response_envelope_class_init(LassoAuthnResponseEnvelopeClass *class) -{ -} - -GType lasso_authn_response_envelope_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoAuthnResponseEnvelopeClass), - NULL, - NULL, - (GClassInitFunc) lasso_authn_response_envelope_class_init, - NULL, - NULL, - sizeof(LassoAuthnResponseEnvelope), - 0, - (GInstanceInitFunc) lasso_authn_response_envelope_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_AUTHN_RESPONSE_ENVELOPE, - "LassoAuthnResponseEnvelope", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_authn_response_envelope_new(LassoAuthnResponse *authnResponse, - xmlChar *assertionConsumerServiceURL) -{ - LassoNode *response; - - g_return_val_if_fail(LASSO_IS_AUTHN_RESPONSE(authnResponse), NULL); - g_return_val_if_fail(assertionConsumerServiceURL!=NULL, NULL); - - response = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHN_RESPONSE_ENVELOPE, NULL)); - - lasso_lib_authn_response_envelope_set_authnResponse(LASSO_LIB_AUTHN_RESPONSE_ENVELOPE(response), - LASSO_LIB_AUTHN_RESPONSE(authnResponse)); - lasso_lib_authn_response_envelope_set_assertionConsumerServiceURL(LASSO_LIB_AUTHN_RESPONSE_ENVELOPE(response), - assertionConsumerServiceURL); - - return response; -} - -static LassoNode * -lasso_authn_response_envelope_new_from_soap(gchar *buffer) -{ - LassoNode *response; - LassoNode *envelope, *lassoNode_response; - xmlNodePtr xmlNode_response; - LassoNodeClass *class; - - response = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHN_RESPONSE_ENVELOPE, NULL)); - - envelope = lasso_node_new_from_dump(buffer); - lassoNode_response = lasso_node_get_child(envelope, "AuthnResponseEnvelope", NULL, NULL); - - class = LASSO_NODE_GET_CLASS(lassoNode_response); - xmlNode_response = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_response)), 1); - lasso_node_destroy(lassoNode_response); - - class = LASSO_NODE_GET_CLASS(response); - class->set_xmlNode(LASSO_NODE(response), xmlNode_response); - lasso_node_destroy(envelope); - - return response; -} - -LassoNode* -lasso_authn_response_envelope_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *response = NULL; - xmlChar *buffer_decoded; - - g_return_val_if_fail(buffer != NULL, NULL); - - switch(export_type){ - case lassoNodeExportTypeBase64: - response = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHN_RESPONSE_ENVELOPE, NULL)); - buffer_decoded = xmlMalloc(strlen(buffer)); - xmlSecBase64Decode(buffer, buffer_decoded, strlen(buffer)); - lasso_node_import(response, buffer_decoded); - xmlFree(buffer_decoded); - break; - case lassoNodeExportTypeSoap: - response = lasso_authn_response_envelope_new_from_soap(buffer); - break; - default: - message(G_LOG_LEVEL_CRITICAL, "Invalid export type\n"); - return NULL; - break; - } - - return response; -} diff --git a/lasso/Attic/protocols/authn_response_envelope.h b/lasso/Attic/protocols/authn_response_envelope.h deleted file mode 100644 index 7c7ab43f..00000000 --- a/lasso/Attic/protocols/authn_response_envelope.h +++ /dev/null @@ -1,72 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_AUTHN_RESPONSE_ENVELOPE_H__ -#define __LASSO_AUTHN_RESPONSE_ENVELOPE_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include - -#define LASSO_TYPE_AUTHN_RESPONSE_ENVELOPE (lasso_authn_response_envelope_get_type()) -#define LASSO_AUTHN_RESPONSE_ENVELOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_AUTHN_RESPONSE_ENVELOPE, LassoAuthnResponseEnvelope)) -#define LASSO_AUTHN_RESPONSE_ENVELOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_AUTHN_RESPONSE_ENVELOPE, LassoAuthnResponseEnvelopeClass)) -#define LASSO_IS_AUTHN_RESPONSE_ENVELOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_AUTHN_RESPONSE_ENVELOPE)) -#define LASSO_IS_AUTHN_RESPONSE_ENVELOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_AUTHN_RESPONSE_ENVELOPE)) -#define LASSO_AUTHN_RESPONSE_ENVELOPE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_AUTHN_RESPONSE_ENVELOPE, LassoAuthnResponseEnvelopeClass)) - -typedef struct _LassoAuthnResponseEnvelope LassoAuthnResponseEnvelope; -typedef struct _LassoAuthnResponseEnvelopeClass LassoAuthnResponseEnvelopeClass; - -struct _LassoAuthnResponseEnvelope { - LassoLibAuthnResponseEnvelope parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoAuthnResponseEnvelopeClass { - LassoLibAuthnResponseEnvelopeClass parent; -}; - -LASSO_EXPORT GType lasso_authn_response_envelope_get_type (void); - -LASSO_EXPORT LassoNode* lasso_authn_response_envelope_new (LassoAuthnResponse *authnResponse, - xmlChar *assertionConsumerServiceURL); - -LASSO_EXPORT LassoNode* lasso_authn_response_envelope_new_from_export (gchar *buffer, - lassoNodeExportType export_type); - -LASSO_EXPORT xmlChar* lasso_authn_response_envelope_get_assertionConsumerServiceURL (LassoAuthnResponseEnvelope *response); - -LASSO_EXPORT LassoNode* lasso_authn_response_envelope_get_authnResponse (LassoAuthnResponseEnvelope *response); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_AUTHN_RESPONSE_ENVELOPE_H__ */ diff --git a/lasso/Attic/protocols/elements/.cvsignore b/lasso/Attic/protocols/elements/.cvsignore deleted file mode 100644 index c97e85d7..00000000 --- a/lasso/Attic/protocols/elements/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -*.lo -*.la -.libs -.deps diff --git a/lasso/Attic/protocols/elements/Makefile.am b/lasso/Attic/protocols/elements/Makefile.am deleted file mode 100644 index 520e72ae..00000000 --- a/lasso/Attic/protocols/elements/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -liblassoincludedir = $(includedir)/lasso/protocols/elements - -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/lasso \ - $(LASSO_DEFINES) \ - $(LASSO_CFLAGS) \ - -DG_LOG_DOMAIN=\"lasso\" - -noinst_LTLIBRARIES = liblasso-elements.la - -liblasso_elements_la_SOURCES = \ - assertion.c \ - authentication_statement.c - -liblassoinclude_HEADERS = \ - assertion.h \ - authentication_statement.h diff --git a/lasso/Attic/protocols/elements/assertion.c b/lasso/Attic/protocols/elements/assertion.c deleted file mode 100644 index b158e97c..00000000 --- a/lasso/Attic/protocols/elements/assertion.c +++ /dev/null @@ -1,102 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_assertion_instance_init(LassoAssertion *assertion) -{ -} - -static void -lasso_assertion_class_init(LassoAssertionClass *class) -{ -} - -GType lasso_assertion_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoAssertionClass), - NULL, - NULL, - (GClassInitFunc) lasso_assertion_class_init, - NULL, - NULL, - sizeof(LassoAssertion), - 0, - (GInstanceInitFunc) lasso_assertion_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_ASSERTION, - "LassoAssertion", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_assertion_new(const xmlChar *issuer, - xmlChar *requestID) -{ - LassoNode *assertion; - xmlChar *id, *time; - - g_return_val_if_fail(issuer != NULL, NULL); - - assertion = LASSO_NODE(g_object_new(LASSO_TYPE_ASSERTION, - "use_xsitype", TRUE, - NULL)); - - id = lasso_build_unique_id(32); - lasso_saml_assertion_set_assertionID(LASSO_SAML_ASSERTION(assertion), id); - xmlFree(id); - lasso_saml_assertion_set_majorVersion(LASSO_SAML_ASSERTION(assertion), - lassoLibMajorVersion); - lasso_saml_assertion_set_minorVersion(LASSO_SAML_ASSERTION(assertion), - lassoLibMinorVersion); - time = lasso_get_current_time(); - lasso_saml_assertion_set_issueInstant(LASSO_SAML_ASSERTION(assertion), time); - xmlFree(time); - - lasso_saml_assertion_set_issuer(LASSO_SAML_ASSERTION(assertion), issuer); - - /* InResponseTo */ - if (requestID != NULL) { - lasso_lib_assertion_set_inResponseTo(LASSO_LIB_ASSERTION(assertion), - requestID); - } - - return assertion; -} diff --git a/lasso/Attic/protocols/elements/assertion.h b/lasso/Attic/protocols/elements/assertion.h deleted file mode 100644 index c0341fd2..00000000 --- a/lasso/Attic/protocols/elements/assertion.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_ASSERTION_H__ -#define __LASSO_ASSERTION_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include - -#define LASSO_TYPE_ASSERTION (lasso_assertion_get_type()) -#define LASSO_ASSERTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_ASSERTION, LassoAssertion)) -#define LASSO_ASSERTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_ASSERTION, LassoAssertionClass)) -#define LASSO_IS_ASSERTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_ASSERTION)) -#define LASSO_IS_ASSERTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_ASSERTION)) -#define LASSO_ASSERTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_ASSERTION, LassoAssertionClass)) - -typedef struct _LassoAssertion LassoAssertion; -typedef struct _LassoAssertionClass LassoAssertionClass; - -struct _LassoAssertion { - LassoLibAssertion parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoAssertionClass { - LassoLibAssertionClass parent; -}; - -LASSO_EXPORT GType lasso_assertion_get_type (void); - -LASSO_EXPORT LassoNode* lasso_assertion_new (const xmlChar *issuer, - xmlChar *requestID); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_ASSERTION_H__ */ diff --git a/lasso/Attic/protocols/elements/authentication_statement.c b/lasso/Attic/protocols/elements/authentication_statement.c deleted file mode 100644 index b4064ce5..00000000 --- a/lasso/Attic/protocols/elements/authentication_statement.c +++ /dev/null @@ -1,149 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_authentication_statement_instance_init(LassoAuthenticationStatement *authentication_statement) -{ -} - -static void -lasso_authentication_statement_class_init(LassoAuthenticationStatementClass *class) -{ -} - -GType lasso_authentication_statement_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoAuthenticationStatementClass), - NULL, - NULL, - (GClassInitFunc) lasso_authentication_statement_class_init, - NULL, - NULL, - sizeof(LassoAuthenticationStatement), - 0, - (GInstanceInitFunc) lasso_authentication_statement_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_AUTHENTICATION_STATEMENT, - "LassoAuthenticationStatement", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_authentication_statement_new(const xmlChar *authenticationMethod, - const xmlChar *reauthenticateOnOrAfter, - LassoSamlNameIdentifier *sp_identifier, - LassoSamlNameIdentifier *idp_identifier) -{ - LassoNode *statement; - LassoNode *new_identifier, *new_idp_identifier; - LassoNode *subject, *subject_confirmation; - gchar *str; - xmlChar *time; - - g_return_val_if_fail(LASSO_IS_SAML_NAME_IDENTIFIER(idp_identifier), NULL); - - statement = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHENTICATION_STATEMENT, - "use_xsitype", TRUE, - NULL)); - - lasso_saml_authentication_statement_set_authenticationMethod(LASSO_SAML_AUTHENTICATION_STATEMENT(statement), - authenticationMethod); - time = lasso_get_current_time(); - lasso_saml_authentication_statement_set_authenticationInstant(LASSO_SAML_AUTHENTICATION_STATEMENT(statement), - time); - xmlFree(time); - lasso_lib_authentication_statement_set_reauthenticateOnOrAfter(LASSO_LIB_AUTHENTICATION_STATEMENT(statement), - reauthenticateOnOrAfter); - - /* use_xsitype = TRUE */ - subject = lasso_lib_subject_new(TRUE); - if (sp_identifier == NULL) { - if (idp_identifier != NULL) { - new_identifier = lasso_node_copy(LASSO_NODE(idp_identifier)); - } - else { - message(G_LOG_LEVEL_CRITICAL, "Failed to create the authentication statement, both name identifiers are NULL\n"); - lasso_node_destroy(statement); - return NULL; - } - } - else { - new_identifier = lasso_node_copy(LASSO_NODE(sp_identifier)); - } - lasso_saml_subject_set_nameIdentifier(LASSO_SAML_SUBJECT(subject), - LASSO_SAML_NAME_IDENTIFIER(new_identifier)); - lasso_node_destroy(new_identifier); - - if (sp_identifier != NULL) { - /* create a new IdpProvidedNameIdentifier and use idp_identifier data to fill it */ - str = lasso_node_get_content(LASSO_NODE(idp_identifier), NULL); - new_idp_identifier = lasso_lib_idp_provided_name_identifier_new(str); - xmlFree(str); - str = lasso_node_get_attr_value(LASSO_NODE(idp_identifier), "NameQualifier", NULL); - if (str != NULL) { - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(new_idp_identifier), str); - xmlFree(str); - } - str = lasso_node_get_attr_value(LASSO_NODE(idp_identifier), "Format", NULL); - if (str != NULL) { - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(new_idp_identifier), str); - xmlFree(str); - } - lasso_lib_subject_set_idpProvidedNameIdentifier(LASSO_LIB_SUBJECT(subject), - LASSO_LIB_IDP_PROVIDED_NAME_IDENTIFIER(new_idp_identifier)); - lasso_node_destroy(new_idp_identifier); - } - - /* SubjectConfirmation & Subject */ - subject_confirmation = lasso_saml_subject_confirmation_new(); - lasso_saml_subject_confirmation_set_subjectConfirmationMethod(LASSO_SAML_SUBJECT_CONFIRMATION(subject_confirmation), - lassoSamlConfirmationMethodBearer); - lasso_saml_subject_set_subjectConfirmation(LASSO_SAML_SUBJECT(subject), - LASSO_SAML_SUBJECT_CONFIRMATION(subject_confirmation)); - - lasso_saml_subject_statement_abstract_set_subject(LASSO_SAML_SUBJECT_STATEMENT_ABSTRACT(statement), - LASSO_SAML_SUBJECT(subject)); - - lasso_node_destroy(subject); - lasso_node_destroy(subject_confirmation); - - return statement; -} diff --git a/lasso/Attic/protocols/elements/authentication_statement.h b/lasso/Attic/protocols/elements/authentication_statement.h deleted file mode 100644 index 0b354349..00000000 --- a/lasso/Attic/protocols/elements/authentication_statement.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_AUTHENTICATION_STATEMENT_H__ -#define __LASSO_AUTHENTICATION_STATEMENT_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include - -#define LASSO_TYPE_AUTHENTICATION_STATEMENT (lasso_authentication_statement_get_type()) -#define LASSO_AUTHENTICATION_STATEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_AUTHENTICATION_STATEMENT, LassoAuthenticationStatement)) -#define LASSO_AUTHENTICATION_STATEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_AUTHENTICATION_STATEMENT, LassoAuthenticationStatementClass)) -#define LASSO_IS_AUTHENTICATION_STATEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_AUTHENTICATION_STATEMENT)) -#define LASSO_IS_AUTHENTICATION_STATEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_AUTHENTICATION_STATEMENT)) -#define LASSO_AUTHENTICATION_STATEMENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_AUTHENTICATION_STATEMENT, LassoAuthenticationStatementClass)) - -typedef struct _LassoAuthenticationStatement LassoAuthenticationStatement; -typedef struct _LassoAuthenticationStatementClass LassoAuthenticationStatementClass; - -struct _LassoAuthenticationStatement { - LassoLibAuthenticationStatement parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoAuthenticationStatementClass { - LassoLibAuthenticationStatementClass parent; -}; - -LASSO_EXPORT GType lasso_authentication_statement_get_type (void); -LASSO_EXPORT LassoNode* lasso_authentication_statement_new (const xmlChar *authenticationMethod, - const xmlChar *reauthenticateOnOrAfter, - LassoSamlNameIdentifier *sp_identifier, - LassoSamlNameIdentifier *idp_identifier); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_AUTHENTICATION_STATEMENT_H__ */ diff --git a/lasso/Attic/protocols/federation.c b/lasso/Attic/protocols/federation.c deleted file mode 100644 index fb55cdc0..00000000 --- a/lasso/Attic/protocols/federation.c +++ /dev/null @@ -1,360 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -struct _LassoFederationPrivate -{ - gboolean dispose_has_run; -}; - -static GObjectClass *parent_class = NULL; - -/*****************************************************************************/ -/* static methods/functions */ -/*****************************************************************************/ - -static LassoNode* -lasso_federation_build_nameIdentifier(const gchar *nameQualifier, - const gchar *format, - const gchar *content) -{ - LassoNode *nameIdentifier; - xmlChar *id; - - if (content == NULL) { - id = lasso_build_unique_id(32); - nameIdentifier = lasso_saml_name_identifier_new(id); - xmlFree(id); - } - else { - nameIdentifier = lasso_saml_name_identifier_new(content); - } - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(nameIdentifier), - nameQualifier); - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(nameIdentifier), - format); - - return nameIdentifier; -} - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -void -lasso_federation_build_local_nameIdentifier(LassoFederation *federation, - const gchar *nameQualifier, - const gchar *format, - const gchar *content) -{ - federation->local_nameIdentifier = lasso_federation_build_nameIdentifier(nameQualifier, - format, - content); -} - -void -lasso_federation_build_remote_nameIdentifier(LassoFederation *federation, - const gchar *nameQualifier, - const gchar *format, - const gchar *content) -{ - federation->remote_nameIdentifier = lasso_federation_build_nameIdentifier(nameQualifier, - format, - content); -} - -LassoFederation* -lasso_federation_copy(LassoFederation *federation) -{ - LassoFederation *copy; - - g_return_val_if_fail(LASSO_IS_FEDERATION(federation), NULL); - - copy = LASSO_FEDERATION(g_object_new(LASSO_TYPE_FEDERATION, NULL)); - copy->remote_providerID = g_strdup(federation->remote_providerID); - if (federation->local_nameIdentifier != NULL) { - copy->local_nameIdentifier = lasso_node_copy(federation->local_nameIdentifier); - } - if (federation->remote_nameIdentifier != NULL) { - copy->remote_nameIdentifier = lasso_node_copy(federation->remote_nameIdentifier); - } - - return copy; -} - -void -lasso_federation_destroy(LassoFederation *federation) -{ - g_object_unref(G_OBJECT(federation)); -} - -gchar * -lasso_federation_dump(LassoFederation *federation) -{ - LassoNode *federation_node, *nameIdentifier; - LassoNode *local_nameIdentifier, *remote_nameIdentifier; - LassoNodeClass *federation_class, *class; - gchar *dump; - - federation_node = lasso_node_new(); - federation_class = LASSO_NODE_GET_CLASS(federation_node); - federation_class->set_name(federation_node, LASSO_FEDERATION_NODE); - federation_class->set_ns(federation_node, lassoLassoHRef, NULL); - - /* set the remote providerID */ - federation_class->set_prop(federation_node, LASSO_FEDERATION_REMOTE_PROVIDERID_NODE, - federation->remote_providerID); - - /* add the remote name identifier */ - if(federation->remote_nameIdentifier != NULL) { - nameIdentifier = lasso_node_new(); - class = LASSO_NODE_GET_CLASS(nameIdentifier); - class->set_name(nameIdentifier, LASSO_FEDERATION_REMOTE_NAME_IDENTIFIER_NODE); - remote_nameIdentifier = lasso_node_copy(federation->remote_nameIdentifier); - class->add_child(nameIdentifier, remote_nameIdentifier, FALSE); - lasso_node_destroy(remote_nameIdentifier); - federation_class->add_child(federation_node, nameIdentifier, FALSE); - lasso_node_destroy(nameIdentifier); - } - - /* add the local name identifier */ - if(federation->local_nameIdentifier != NULL) { - nameIdentifier = lasso_node_new(); - class = LASSO_NODE_GET_CLASS(nameIdentifier); - class->set_name(nameIdentifier, LASSO_FEDERATION_LOCAL_NAME_IDENTIFIER_NODE); - local_nameIdentifier = lasso_node_copy(federation->local_nameIdentifier); - class->add_child(nameIdentifier, local_nameIdentifier, FALSE); - lasso_node_destroy(local_nameIdentifier); - federation_class->add_child(federation_node, nameIdentifier, FALSE); - lasso_node_destroy(nameIdentifier); - } - - dump = lasso_node_export(federation_node); - lasso_node_destroy(federation_node); - - return dump; -} - -LassoNode * -lasso_federation_get_local_nameIdentifier(LassoFederation *federation) -{ - if (federation->local_nameIdentifier != NULL) { - return lasso_node_copy(federation->local_nameIdentifier); - } - else { - return NULL; - } -} - -LassoNode * -lasso_federation_get_remote_nameIdentifier(LassoFederation *federation) -{ - if (federation->remote_nameIdentifier != NULL) { - return lasso_node_copy(federation->remote_nameIdentifier); - } - else { - return NULL; - } -} - -void -lasso_federation_remove_local_nameIdentifier(LassoFederation *federation) -{ - if(federation->local_nameIdentifier != NULL) { - lasso_node_destroy(federation->local_nameIdentifier); - } -} - -void -lasso_federation_remove_remote_nameIdentifier(LassoFederation *federation) -{ - if(federation->remote_nameIdentifier != NULL){ - lasso_node_destroy(federation->remote_nameIdentifier); - } -} - -void -lasso_federation_set_local_nameIdentifier(LassoFederation *federation, - LassoNode *nameIdentifier) -{ - if(federation->local_nameIdentifier != NULL) { - lasso_node_destroy(federation->local_nameIdentifier); - } - federation->local_nameIdentifier = lasso_node_copy(nameIdentifier); -} - -void -lasso_federation_set_remote_nameIdentifier(LassoFederation *federation, - LassoNode *nameIdentifier) -{ - if(federation->remote_nameIdentifier != NULL) { - lasso_node_destroy(federation->remote_nameIdentifier); - } - federation->remote_nameIdentifier = lasso_node_copy(nameIdentifier); -} - -gboolean -lasso_federation_verify_nameIdentifier(LassoFederation *federation, - LassoNode *nameIdentifier) -{ - gchar *federation_content, *nameIdentifier_content; - - g_return_val_if_fail(LASSO_IS_FEDERATION(federation), FALSE); - g_return_val_if_fail(LASSO_IS_NODE(nameIdentifier), FALSE); - - /* verify local name identifier */ - nameIdentifier_content = lasso_node_get_content(nameIdentifier, NULL); - if(federation->local_nameIdentifier != NULL) { - federation_content = lasso_node_get_content(federation->local_nameIdentifier, - NULL); - if(xmlStrEqual(federation_content, nameIdentifier_content)) { - xmlFree(federation_content); - return TRUE; - } - xmlFree(federation_content); - } - - /* verify remote name identifier */ - if(federation->remote_nameIdentifier != NULL) { - federation_content = lasso_node_get_content(federation->remote_nameIdentifier, - NULL); - if(xmlStrEqual(federation_content, nameIdentifier_content)) { - xmlFree(federation_content); - return TRUE; - } - xmlFree(federation_content); - } - xmlFree(nameIdentifier_content); - - return FALSE; -} - -/*****************************************************************************/ -/* overrided parent class methods */ -/*****************************************************************************/ - -static void -lasso_federation_dispose(LassoFederation *federation) -{ - if (federation->private->dispose_has_run) { - return; - } - federation->private->dispose_has_run = TRUE; - - debug("Federation object 0x%x disposed ...\n", federation); - - /* unref reference counted objects */ - lasso_node_destroy(federation->local_nameIdentifier); - lasso_node_destroy(federation->remote_nameIdentifier); - - parent_class->dispose(G_OBJECT(federation)); -} - -static void -lasso_federation_finalize(LassoFederation *federation) -{ - debug("Federation object 0x%x finalized ...\n", federation); - - g_free(federation->remote_providerID); - g_free(federation->private); - - parent_class->finalize(G_OBJECT(federation)); -} - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_federation_instance_init(LassoFederation *federation) -{ - federation->private = g_new (LassoFederationPrivate, 1); - federation->private->dispose_has_run = FALSE; - - federation->remote_providerID = NULL; - federation->local_nameIdentifier = NULL; - federation->remote_nameIdentifier = NULL; -} - -static void -lasso_federation_class_init(LassoFederationClass *g_class) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (g_class); - - parent_class = g_type_class_peek_parent(g_class); - /* override parent class methods */ - gobject_class->dispose = (void *)lasso_federation_dispose; - gobject_class->finalize = (void *)lasso_federation_finalize; -} - -GType lasso_federation_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoFederationClass), - NULL, - NULL, - (GClassInitFunc) lasso_federation_class_init, - NULL, - NULL, - sizeof(LassoFederation), - 0, - (GInstanceInitFunc) lasso_federation_instance_init, - }; - - this_type = g_type_register_static(G_TYPE_OBJECT, - "LassoFederation", - &this_info, 0); - } - return this_type; -} - -LassoFederation* -lasso_federation_new(gchar *remote_providerID) -{ - LassoFederation *federation; - - g_return_val_if_fail(remote_providerID != NULL, NULL); - - federation = LASSO_FEDERATION(g_object_new(LASSO_TYPE_FEDERATION, NULL)); - - federation->remote_providerID = g_strdup(remote_providerID); - - return federation; -} - -LassoFederation* -lasso_federation_new_from_dump(gchar *dump) -{ - LassoFederation *federation; - - g_return_val_if_fail(dump != NULL, NULL); - - federation = LASSO_FEDERATION(g_object_new(LASSO_TYPE_FEDERATION, NULL)); - - return federation; -} diff --git a/lasso/Attic/protocols/federation.h b/lasso/Attic/protocols/federation.h deleted file mode 100644 index ae4a2ebb..00000000 --- a/lasso/Attic/protocols/federation.h +++ /dev/null @@ -1,111 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_FEDERATION_H__ -#define __LASSO_FEDERATION_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include - -#define LASSO_TYPE_FEDERATION (lasso_federation_get_type()) -#define LASSO_FEDERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_FEDERATION, LassoFederation)) -#define LASSO_FEDERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_FEDERATION, LassoFederationClass)) -#define LASSO_IS_FEDERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_FEDERATION)) -#define LASSO_IS_FEDERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_FEDERATION)) -#define LASSO_FEDERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_FEDERATION, LassoFederationClass)) - -#define LASSO_FEDERATION_NODE "Federation" -#define LASSO_FEDERATION_REMOTE_PROVIDERID_NODE "RemoteProviderID" -#define LASSO_FEDERATION_LOCAL_NAME_IDENTIFIER_NODE "LocalNameIdentifier" -#define LASSO_FEDERATION_REMOTE_NAME_IDENTIFIER_NODE "RemoteNameIdentifier" - -typedef struct _LassoFederation LassoFederation; -typedef struct _LassoFederationClass LassoFederationClass; -typedef struct _LassoFederationPrivate LassoFederationPrivate; - -struct _LassoFederation { - GObject parent; - - gchar *remote_providerID; - - LassoNode *local_nameIdentifier; - LassoNode *remote_nameIdentifier; - - /*< private >*/ - LassoFederationPrivate *private; -}; - -struct _LassoFederationClass { - GObjectClass parent; -}; - -LASSO_EXPORT GType lasso_federation_get_type (void); - -LASSO_EXPORT LassoFederation* lasso_federation_new (gchar *remote_providerID); - -LASSO_EXPORT LassoFederation* lasso_federation_new_from_dump (gchar *dump); - -LASSO_EXPORT void lasso_federation_build_local_nameIdentifier (LassoFederation *federation, - const gchar *nameQualifier, - const gchar *format, - const gchar *content); - -LASSO_EXPORT void lasso_federation_build_remote_nameIdentifier (LassoFederation *federation, - const gchar *nameQualifier, - const gchar *format, - const gchar *content); - -LASSO_EXPORT LassoFederation* lasso_federation_copy (LassoFederation *federation); - -LASSO_EXPORT void lasso_federation_destroy (LassoFederation *federation); - -LASSO_EXPORT gchar* lasso_federation_dump (LassoFederation *federation); - -LASSO_EXPORT LassoNode* lasso_federation_get_remote_nameIdentifier (LassoFederation *federation); - -LASSO_EXPORT LassoNode* lasso_federation_get_local_nameIdentifier (LassoFederation *federation); - -LASSO_EXPORT void lasso_federation_remove_local_nameIdentifier (LassoFederation *federation); - -LASSO_EXPORT void lasso_federation_remove_remote_nameIdentifier (LassoFederation *federation); - -LASSO_EXPORT void lasso_federation_set_local_nameIdentifier (LassoFederation *federation, - LassoNode *nameIdentifier); - -LASSO_EXPORT void lasso_federation_set_remote_nameIdentifier (LassoFederation *federation, - LassoNode *nameIdentifier); - -LASSO_EXPORT gboolean lasso_federation_verify_nameIdentifier (LassoFederation *federation, - LassoNode *nameIdentifier); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_FEDERATION_H__ */ diff --git a/lasso/Attic/protocols/federation_termination_notification.c b/lasso/Attic/protocols/federation_termination_notification.c deleted file mode 100644 index 1e337609..00000000 --- a/lasso/Attic/protocols/federation_termination_notification.c +++ /dev/null @@ -1,262 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_federation_termination_notification_instance_init(LassoFederationTerminationNotification *request) -{ -} - -static void -lasso_federation_termination_notification_class_init(LassoFederationTerminationNotificationClass *class) -{ -} - -GType lasso_federation_termination_notification_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoFederationTerminationNotificationClass), - NULL, - NULL, - (GClassInitFunc) lasso_federation_termination_notification_class_init, - NULL, - NULL, - sizeof(LassoFederationTerminationNotification), - 0, - (GInstanceInitFunc) lasso_federation_termination_notification_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_FEDERATION_TERMINATION_NOTIFICATION, - "LassoFederationTerminationNotification", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_federation_termination_notification_new(const xmlChar *providerID, - const xmlChar *nameIdentifier, - const xmlChar *nameQualifier, - const xmlChar *format, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method) -{ - LassoNode *request, *identifier; - xmlChar *id, *time; - - request = LASSO_NODE(g_object_new(LASSO_TYPE_FEDERATION_TERMINATION_NOTIFICATION, NULL)); - - /* Set ONLY required elements/attributes */ - /* RequestID */ - id = lasso_build_unique_id(32); - lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), - id); - xmlFree(id); - /* MajorVersion */ - lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMajorVersion); - /* MinorVersion */ - lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMinorVersion); - /* IssueInstant */ - time = lasso_get_current_time(); - lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request), - time); - xmlFree(time); - - /* set the signature template */ - if (sign_type != lassoSignatureTypeNone) { - lasso_samlp_request_abstract_set_signature_tmpl(LASSO_SAMLP_REQUEST_ABSTRACT(request), - sign_type, - sign_method, - NULL); - } - - /* ProviderID */ - lasso_lib_federation_termination_notification_set_providerID(LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION(request), - providerID); - - identifier = lasso_saml_name_identifier_new(nameIdentifier); - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(identifier), nameQualifier); - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(identifier), format); - - lasso_lib_federation_termination_notification_set_nameIdentifier(LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION(request), - LASSO_SAML_NAME_IDENTIFIER(identifier)); - lasso_node_destroy(identifier); - - return request; -} - -LassoNode * -lasso_federation_termination_notification_new_from_query(const gchar *query) -{ - LassoNode *notification, *identifier; - xmlChar *str; - GData *gd; - - notification = LASSO_NODE(g_object_new(LASSO_TYPE_FEDERATION_TERMINATION_NOTIFICATION, NULL)); - - gd = lasso_query_to_dict(query); - if (gd == NULL) { - g_object_unref(notification); - return NULL; - } - - /* RequestID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "RequestID"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(notification); - return NULL; - } - lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(notification), str); - - /* MajorVersion */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MajorVersion"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(notification); - return (NULL); - } - lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(notification), str); - - /* MinorVersion */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MinorVersion"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(notification); - return NULL; - } - lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(notification), str); - - /* IssueInstant */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "IssueInstant"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(notification); - return NULL; - } - lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(notification), str); - - /* ProviderID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "ProviderID"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(notification); - return NULL; - } - lasso_lib_federation_termination_notification_set_providerID(LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION(notification), str); - - /* NameIdentifier */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "NameIdentifier"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(notification); - return NULL; - } - identifier = lasso_saml_name_identifier_new(str); - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "NameQualifier"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(notification); - return NULL; - } - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(identifier), str); - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "Format"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(notification); - return NULL; - } - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(identifier), str); - - lasso_lib_federation_termination_notification_set_nameIdentifier(LASSO_LIB_FEDERATION_TERMINATION_NOTIFICATION(notification), - LASSO_SAML_NAME_IDENTIFIER(identifier)); - - lasso_node_destroy(identifier); - - return notification; -} - -LassoNode * -lasso_federation_termination_notification_new_from_soap(const gchar *buffer) -{ - LassoNode *notification; - LassoNode *envelope, *lassoNode_notification; - xmlNodePtr xmlNode_notification; - LassoNodeClass *class; - - envelope = lasso_node_new_from_dump(buffer); - if (LASSO_IS_NODE(envelope) == FALSE) { - return NULL; - } - - notification = LASSO_NODE(g_object_new(LASSO_TYPE_FEDERATION_TERMINATION_NOTIFICATION, NULL)); - lassoNode_notification = lasso_node_get_child(envelope, "FederationTerminationNotification", - lassoLibHRef, NULL); - class = LASSO_NODE_GET_CLASS(lassoNode_notification); - xmlNode_notification = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_notification)), 1); - lasso_node_destroy(lassoNode_notification); - class = LASSO_NODE_GET_CLASS(notification); - class->set_xmlNode(LASSO_NODE(notification), xmlNode_notification); - lasso_node_destroy(envelope); - - return notification; -} - - -LassoNode* -lasso_federation_termination_notification_new_from_export(const gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *notification; - - g_return_val_if_fail(buffer != NULL, NULL); - - switch(export_type){ - case lassoNodeExportTypeQuery: - notification = lasso_federation_termination_notification_new_from_query(buffer); - break; - case lassoNodeExportTypeSoap: - notification = lasso_federation_termination_notification_new_from_soap(buffer); - break; - default: - return NULL; - } - - return notification; -} diff --git a/lasso/Attic/protocols/federation_termination_notification.h b/lasso/Attic/protocols/federation_termination_notification.h deleted file mode 100644 index 6d4edc3c..00000000 --- a/lasso/Attic/protocols/federation_termination_notification.h +++ /dev/null @@ -1,71 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Author: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_FEDERATION_TERMINATION_NOTIFICATION_H__ -#define __LASSO_FEDERATION_TERMINATION_NOTIFICATION_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include - -#define LASSO_TYPE_FEDERATION_TERMINATION_NOTIFICATION (lasso_federation_termination_notification_get_type()) -#define LASSO_FEDERATION_TERMINATION_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_FEDERATION_TERMINATION_NOTIFICATION, LassoFederationTerminationNotification)) -#define LASSO_FEDERATION_TERMINATION_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_FEDERATION_TERMINATION_NOTIFICATION, LassoFederationTerminationNotificationClass)) -#define LASSO_IS_FEDERATION_TERMINATION_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_FEDERATION_TERMINATION_NOTIFICATION)) -#define LASSO_IS_FEDERATION_TERMINATION_NOTIFICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_FEDERATION_TERMINATION_NOTIFICATION)) -#define LASSO_FEDERATION_TERMINATION_NOTIFICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_FEDERATION_TERMINATION_NOTIFICATION, LassoFederationTerminationNotificationClass)) - -typedef struct _LassoFederationTerminationNotification LassoFederationTerminationNotification; -typedef struct _LassoFederationTerminationNotificationClass LassoFederationTerminationNotificationClass; - -struct _LassoFederationTerminationNotification { - LassoLibFederationTerminationNotification parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoFederationTerminationNotificationClass { - LassoLibFederationTerminationNotificationClass parent; -}; - -LASSO_EXPORT GType lasso_federation_termination_notification_get_type (void); - -LASSO_EXPORT LassoNode* lasso_federation_termination_notification_new (const xmlChar *providerID, - const xmlChar *nameIdentifier, - const xmlChar *nameQualifier, - const xmlChar *format, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method); - -LASSO_EXPORT LassoNode* lasso_federation_termination_notification_new_from_export (const gchar *export, - lassoNodeExportType export_type); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_FEDERATION_TERMINATION_NOTIFICATION_H__ */ diff --git a/lasso/Attic/protocols/logout_request.c b/lasso/Attic/protocols/logout_request.c deleted file mode 100644 index 17cc7585..00000000 --- a/lasso/Attic/protocols/logout_request.c +++ /dev/null @@ -1,303 +0,0 @@ - -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_logout_request_instance_init(LassoLogoutRequest *request) -{ -} - -static void -lasso_logout_request_class_init(LassoLogoutRequestClass *class) -{ -} - -GType lasso_logout_request_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoLogoutRequestClass), - NULL, - NULL, - (GClassInitFunc) lasso_logout_request_class_init, - NULL, - NULL, - sizeof(LassoLogoutRequest), - 0, - (GInstanceInitFunc) lasso_logout_request_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_LOGOUT_REQUEST, - "LassoLogoutRequest", - &this_info, 0); - } - return this_type; -} - -LassoNode * -lasso_logout_request_new(gchar *providerID, - gchar *nameIdentifier, - gchar *nameQualifier, - gchar *format, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method) -{ - LassoNode *request, *identifier; - xmlChar *request_id, *time; - - - request = LASSO_NODE(g_object_new(LASSO_TYPE_LOGOUT_REQUEST, NULL)); - - /* RequestID */ - request_id = lasso_build_unique_id(32); - lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), - request_id); - /* MajorVersion */ - lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMajorVersion); - /* MinorVersion */ - lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMinorVersion); - /* IssueInstant */ - time = lasso_get_current_time(); - lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request), - time); - xmlFree(time); - - /* set the signature template */ - if (sign_type != lassoSignatureTypeNone) { - lasso_samlp_request_abstract_set_signature_tmpl(LASSO_SAMLP_REQUEST_ABSTRACT(request), - sign_type, - sign_method, - NULL); - } - - xmlFree(request_id); - - /* ProviderID */ - lasso_lib_logout_request_set_providerID(LASSO_LIB_LOGOUT_REQUEST(request), - providerID); - - identifier = lasso_saml_name_identifier_new(nameIdentifier); - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(identifier), - nameQualifier); - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(identifier), format); - - lasso_lib_logout_request_set_nameIdentifier(LASSO_LIB_LOGOUT_REQUEST(request), - LASSO_SAML_NAME_IDENTIFIER(identifier)); - lasso_node_destroy(identifier); - - return request; -} - -static LassoNode * -lasso_logout_request_new_from_query(gchar *query) -{ - LassoNode *request, *identifier; - xmlChar *str; - GData *gd; - - request = LASSO_NODE(g_object_new(LASSO_TYPE_LOGOUT_REQUEST, NULL)); - - gd = lasso_query_to_dict(query); - if (gd == NULL) { - g_object_unref(request); - return NULL; - } - - /* RequestID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "RequestID"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), str); - - /* MajorVersion */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MajorVersion"), 0); - lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), str); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - - /* MinorVersion */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MinorVersion"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), str); - - /* IssueInstant */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "IssueInstant"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request), str); - - /* ProviderID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "ProviderID"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_lib_logout_request_set_providerID(LASSO_LIB_LOGOUT_REQUEST(request), str); - - /* NameIdentifier */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "NameIdentifier"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - identifier = lasso_saml_name_identifier_new(str); - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "NameQualifier"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(identifier), str); - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "Format"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(identifier), str); - lasso_lib_logout_request_set_nameIdentifier(LASSO_LIB_LOGOUT_REQUEST(request), LASSO_SAML_NAME_IDENTIFIER(identifier)); - lasso_node_destroy(identifier); - - /* RelayState */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "RelayState"), 0); - if (str != NULL) - lasso_lib_logout_request_set_relayState(LASSO_LIB_LOGOUT_REQUEST(request), str); - - /* SessionIndex */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "SessionIndex"), 0); - if (str != NULL) - lasso_lib_logout_request_set_sessionIndex(LASSO_LIB_LOGOUT_REQUEST(request), str); - - /* consent */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "consent"), 0); - if (str != NULL) - lasso_lib_logout_request_set_consent(LASSO_LIB_LOGOUT_REQUEST(request), str); - - g_datalist_clear(&gd); - - return request; -} - -static LassoNode * -lasso_logout_request_new_from_soap(gchar *buffer) -{ - LassoNode *request; - LassoNode *envelope, *lassoNode_request; - xmlNodePtr xmlNode_request; - LassoNodeClass *class; - - envelope = lasso_node_new_from_dump(buffer); - if (LASSO_IS_NODE(envelope) == FALSE) { - return NULL; - } - - request = LASSO_NODE(g_object_new(LASSO_TYPE_LOGOUT_REQUEST, NULL)); - lassoNode_request = lasso_node_get_child(envelope, "LogoutRequest", - lassoLibHRef, NULL); - class = LASSO_NODE_GET_CLASS(lassoNode_request); - xmlNode_request = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_request)), 1); - lasso_node_destroy(lassoNode_request); - class = LASSO_NODE_GET_CLASS(request); - class->set_xmlNode(LASSO_NODE(request), xmlNode_request); - lasso_node_destroy(envelope); - - return request; -} - -static LassoNode * -lasso_logout_request_new_from_xml(gchar *buffer) -{ - LassoNode *request; - LassoNode *lassoNode_request; - xmlNodePtr xmlNode_request; - LassoNodeClass *class; - - request = LASSO_NODE(g_object_new(LASSO_TYPE_LOGOUT_REQUEST, NULL)); - - lassoNode_request = lasso_node_new_from_dump(buffer); - class = LASSO_NODE_GET_CLASS(lassoNode_request); - xmlNode_request = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_request)), 1); - class = LASSO_NODE_GET_CLASS(request); - class->set_xmlNode(LASSO_NODE(request), xmlNode_request); - lasso_node_destroy(lassoNode_request); - - return request; -} - - -LassoNode* -lasso_logout_request_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *request = NULL; - - g_return_val_if_fail(buffer != NULL, NULL); - - switch(export_type){ - case lassoNodeExportTypeQuery: - request = lasso_logout_request_new_from_query(buffer); - break; - case lassoNodeExportTypeSoap: - request = lasso_logout_request_new_from_soap(buffer); - break; - case lassoNodeExportTypeXml: - request = lasso_logout_request_new_from_xml(buffer); - break; - default: - message(G_LOG_LEVEL_CRITICAL, "Unsupported export type\n"); - break; - } - - return request; -} diff --git a/lasso/Attic/protocols/logout_request.h b/lasso/Attic/protocols/logout_request.h deleted file mode 100644 index dea4261d..00000000 --- a/lasso/Attic/protocols/logout_request.h +++ /dev/null @@ -1,71 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_LOGOUT_REQUEST_H__ -#define __LASSO_LOGOUT_REQUEST_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include - -#define LASSO_TYPE_LOGOUT_REQUEST (lasso_logout_request_get_type()) -#define LASSO_LOGOUT_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LOGOUT_REQUEST, LassoLogoutRequest)) -#define LASSO_LOGOUT_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LOGOUT_REQUEST, LassoLogoutRequestClass)) -#define LASSO_IS_LOGOUT_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LOGOUT_REQUEST)) -#define LASSO_IS_LOGOUT_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LOGOUT_REQUEST)) -#define LASSO_LOGOUT_REQUEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LOGOUT_REQUEST, LassoLogoutRequestClass)) - -typedef struct _LassoLogoutRequest LassoLogoutRequest; -typedef struct _LassoLogoutRequestClass LassoLogoutRequestClass; - -struct _LassoLogoutRequest { - LassoLibLogoutRequest parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoLogoutRequestClass { - LassoLibLogoutRequestClass parent; -}; - -LASSO_EXPORT GType lasso_logout_request_get_type (void); - -LASSO_EXPORT LassoNode* lasso_logout_request_new (gchar *providerID, - gchar *nameIdentifier, - gchar *nameQualifier, - gchar *format, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method); - -LASSO_EXPORT LassoNode* lasso_logout_request_new_from_export (gchar *buffer, - lassoNodeExportType export_type); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_LOGOUT_REQUEST_H__ */ diff --git a/lasso/Attic/protocols/logout_response.c b/lasso/Attic/protocols/logout_response.c deleted file mode 100644 index 26418977..00000000 --- a/lasso/Attic/protocols/logout_response.c +++ /dev/null @@ -1,352 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -gchar* -lasso_logout_response_get_status_code_value(LassoLogoutResponse *response) -{ - LassoNode *status_code; - xmlChar *value; - GError *err = NULL; - - status_code = lasso_node_get_child(LASSO_NODE(response), "StatusCode", - NULL, NULL); - if (status_code != NULL) { - value = lasso_node_get_attr_value(status_code, "Value", &err); - lasso_node_destroy(status_code); - if (err != NULL) { - message(G_LOG_LEVEL_WARNING, err->message); - g_error_free(err); - return NULL; - } - else { - return value; - } - } - else { - message(G_LOG_LEVEL_WARNING, "No StatusCode element found in Response.\n"); - return NULL; - } -} - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_logout_response_instance_init(LassoLogoutResponse *response) -{ -} - -static void -lasso_logout_response_class_init(LassoLogoutResponseClass *class) -{ -} - -GType lasso_logout_response_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoLogoutResponseClass), - NULL, - NULL, - (GClassInitFunc) lasso_logout_response_class_init, - NULL, - NULL, - sizeof(LassoLogoutResponse), - 0, - (GInstanceInitFunc) lasso_logout_response_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_LOGOUT_RESPONSE, - "LassoLogoutResponse", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_logout_response_new(gchar *providerID, - const gchar *statusCodeValue, - LassoNode *request, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method) -{ - LassoNode *response, *ss, *ssc; - xmlChar *inResponseTo, *request_providerID, *request_relayState; - xmlChar *id, *time; - - response = LASSO_NODE(g_object_new(LASSO_TYPE_LOGOUT_RESPONSE, NULL)); - - /* Set ONLY required elements/attributes */ - /* ResponseID */ - id = lasso_build_unique_id(32); - lasso_samlp_response_abstract_set_responseID(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - id); - xmlFree(id); - /* MajorVersion */ - lasso_samlp_response_abstract_set_majorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - lassoLibMajorVersion); - /* MinorVersion */ - lasso_samlp_response_abstract_set_minorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - lassoLibMinorVersion); - /* IssueInstant */ - time = lasso_get_current_time(); - lasso_samlp_response_abstract_set_issueInstant(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - time); - xmlFree(time); - - /* set the signature template */ - if (sign_type != lassoSignatureTypeNone) { - lasso_samlp_response_abstract_set_signature_tmpl(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - sign_type, - sign_method); - } - - /* ProviderID */ - lasso_lib_status_response_set_providerID(LASSO_LIB_STATUS_RESPONSE(response), - providerID); - - inResponseTo = lasso_node_get_attr_value(request, "RequestID", NULL); - lasso_samlp_response_abstract_set_inResponseTo(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - inResponseTo); - xmlFree(inResponseTo); - - request_providerID = lasso_node_get_child_content(request, "ProviderID", NULL, NULL); - lasso_samlp_response_abstract_set_recipient(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - request_providerID); - xmlFree(request_providerID); - - request_relayState = lasso_node_get_child_content(request, "RelayState", NULL, NULL); - if (request_relayState != NULL) { - lasso_lib_status_response_set_relayState(LASSO_LIB_STATUS_RESPONSE(response), - request_relayState); - xmlFree(request_relayState); - } - - ss = lasso_samlp_status_new(); - ssc = lasso_samlp_status_code_new(); - lasso_samlp_status_code_set_value(LASSO_SAMLP_STATUS_CODE(ssc), - statusCodeValue); - lasso_samlp_status_set_statusCode(LASSO_SAMLP_STATUS(ss), - LASSO_SAMLP_STATUS_CODE(ssc)); - lasso_lib_status_response_set_status(LASSO_LIB_STATUS_RESPONSE(response), - LASSO_SAMLP_STATUS(ss)); - lasso_node_destroy(ssc); - lasso_node_destroy(ss); - - return response; -} - -LassoNode * -lasso_logout_response_new_from_dump(gchar *buffer) -{ - LassoNode *response; - - response = LASSO_NODE(g_object_new(LASSO_TYPE_LOGOUT_RESPONSE, NULL)); - lasso_node_import(response, buffer); - - return response; -} - -LassoNode * -lasso_logout_response_new_from_query(gchar *query) -{ - LassoNode *response, *ss, *ssc; - xmlChar *str; - GData *gd; - - response = LASSO_NODE(g_object_new(LASSO_TYPE_LOGOUT_RESPONSE, NULL)); - - gd = lasso_query_to_dict(query); - if (gd == NULL) { - g_object_unref(response); - return NULL; - } - - /* ResponseID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "ResponseID"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_samlp_response_abstract_set_responseID(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str); - - /* MajorVersion */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MajorVersion"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_samlp_response_abstract_set_majorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str); - - /* MinorVersion */ - lasso_samlp_response_abstract_set_minorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MinorVersion"), 0)); - - /* IssueInstant */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "IssueInstant"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_samlp_response_abstract_set_issueInstant(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str); - - /* InResponseTo */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "InResponseTo"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_samlp_response_abstract_set_inResponseTo(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str); - - /* Recipient */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "Recipient"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_samlp_response_abstract_set_recipient(LASSO_SAMLP_RESPONSE_ABSTRACT(response), str); - - /* ProviderID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "ProviderID"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_lib_status_response_set_providerID(LASSO_LIB_STATUS_RESPONSE(response), str); - - /* StatusCode */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "Value"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - ss = lasso_samlp_status_new(); - ssc = lasso_samlp_status_code_new(); - lasso_samlp_status_code_set_value(LASSO_SAMLP_STATUS_CODE(ssc), - str); - lasso_samlp_status_set_statusCode(LASSO_SAMLP_STATUS(ss), - LASSO_SAMLP_STATUS_CODE(ssc)); - lasso_lib_status_response_set_status(LASSO_LIB_STATUS_RESPONSE(response), - LASSO_SAMLP_STATUS(ss)); - lasso_node_destroy(ssc); - lasso_node_destroy(ss); - - - /* RelayState */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "RelayState"), 0); - if (str != NULL) - lasso_lib_status_response_set_relayState(LASSO_LIB_STATUS_RESPONSE(response), str); - - g_datalist_clear(&gd); - - return response; -} - -LassoNode * -lasso_logout_response_new_from_soap(gchar *buffer) -{ - LassoNode *response; - LassoNode *envelope, *lassoNode_response; - xmlNodePtr xmlNode_response; - LassoNodeClass *class; - - envelope = lasso_node_new_from_dump(buffer); - if(LASSO_IS_NODE(envelope) == FALSE) { - return NULL; - } - - response = LASSO_NODE(g_object_new(LASSO_TYPE_LOGOUT_RESPONSE, NULL)); - lassoNode_response = lasso_node_get_child(envelope, "LogoutResponse", - NULL, NULL); - class = LASSO_NODE_GET_CLASS(lassoNode_response); - xmlNode_response = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_response)), 1); - lasso_node_destroy(lassoNode_response); - class = LASSO_NODE_GET_CLASS(response); - class->set_xmlNode(LASSO_NODE(response), xmlNode_response); - lasso_node_destroy(envelope); - - return response; -} - -static LassoNode * -lasso_logout_response_new_from_xml(gchar *buffer) -{ - LassoNode *response; - LassoNode *lassoNode_response; - xmlNodePtr xmlNode_response; - LassoNodeClass *class; - - response = LASSO_NODE(g_object_new(LASSO_TYPE_LOGOUT_RESPONSE, NULL)); - - lassoNode_response = lasso_node_new_from_dump(buffer); - class = LASSO_NODE_GET_CLASS(lassoNode_response); - xmlNode_response = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_response)), 1); - class = LASSO_NODE_GET_CLASS(response); - class->set_xmlNode(LASSO_NODE(response), xmlNode_response); - lasso_node_destroy(lassoNode_response); - - return response; -} - -LassoNode* -lasso_logout_response_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *response; - - g_return_val_if_fail(buffer != NULL, NULL); - - switch(export_type){ - case lassoNodeExportTypeQuery: - response = lasso_logout_response_new_from_query(buffer); - break; - case lassoNodeExportTypeSoap: - response = lasso_logout_response_new_from_soap(buffer); - break; - case lassoNodeExportTypeXml: - response = lasso_logout_response_new_from_xml(buffer); - break; - default: - message(G_LOG_LEVEL_WARNING, "Invalid export type\n"); - return NULL; - } - - return response; -} diff --git a/lasso/Attic/protocols/logout_response.h b/lasso/Attic/protocols/logout_response.h deleted file mode 100644 index ac0dbf6f..00000000 --- a/lasso/Attic/protocols/logout_response.h +++ /dev/null @@ -1,71 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_LOGOUT_RESPONSE_H__ -#define __LASSO_LOGOUT_RESPONSE_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include - -#define LASSO_TYPE_LOGOUT_RESPONSE (lasso_logout_response_get_type()) -#define LASSO_LOGOUT_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LOGOUT_RESPONSE, LassoLogoutResponse)) -#define LASSO_LOGOUT_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_LOGOUT_RESPONSE, LassoLogoutResponseClass)) -#define LASSO_IS_LOGOUT_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_LOGOUT_RESPONSE)) -#define LASSO_IS_LOGOUT_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_LOGOUT_RESPONSE)) -#define LASSO_LOGOUT_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_LOGOUT_RESPONSE, LassoLogoutResponseClass)) - -typedef struct _LassoLogoutResponse LassoLogoutResponse; -typedef struct _LassoLogoutResponseClass LassoLogoutResponseClass; - -struct _LassoLogoutResponse { - LassoLibLogoutResponse parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoLogoutResponseClass { - LassoLibLogoutResponseClass parent; -}; - -LASSO_EXPORT GType lasso_logout_response_get_type (void); - -LASSO_EXPORT LassoNode* lasso_logout_response_new (gchar *providerID, - const gchar *statusCodeValue, - LassoNode *request, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method); - -LASSO_EXPORT LassoNode* lasso_logout_response_new_from_export (gchar *buffer, - lassoNodeExportType export_type); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_LOGOUT_RESPONSE_H__ */ diff --git a/lasso/Attic/protocols/name_identifier_mapping_request.c b/lasso/Attic/protocols/name_identifier_mapping_request.c deleted file mode 100644 index f4084571..00000000 --- a/lasso/Attic/protocols/name_identifier_mapping_request.c +++ /dev/null @@ -1,196 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_name_identifier_mapping_request_instance_init(LassoNameIdentifierMappingRequest *request) -{ -} - -static void -lasso_name_identifier_mapping_request_class_init(LassoNameIdentifierMappingRequestClass *class) -{ -} - -GType lasso_name_identifier_mapping_request_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoNameIdentifierMappingRequestClass), - NULL, - NULL, - (GClassInitFunc) lasso_name_identifier_mapping_request_class_init, - NULL, - NULL, - sizeof(LassoNameIdentifierMappingRequest), - 0, - (GInstanceInitFunc) lasso_name_identifier_mapping_request_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_REQUEST, - "LassoNameIdentifierMappingRequest", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_name_identifier_mapping_request_new(const xmlChar *providerID, - const xmlChar *nameIdentifier, - const xmlChar *nameQualifier, - const xmlChar *format, - const xmlChar *targetNameSpace, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method) -{ - LassoNode *request, *identifier; - xmlChar *id, *time; - - g_return_val_if_fail(providerID != NULL, NULL); - g_return_val_if_fail(nameIdentifier != NULL, NULL); - g_return_val_if_fail(nameQualifier != NULL, NULL); - g_return_val_if_fail(format != NULL, NULL); - g_return_val_if_fail(targetNameSpace != NULL, NULL); - - request = LASSO_NODE(g_object_new(LASSO_TYPE_NAME_IDENTIFIER_MAPPING_REQUEST, NULL)); - - /* Set ONLY required elements/attributes */ - /* RequestID */ - id = lasso_build_unique_id(32); - lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), - id); - xmlFree(id); - /* MajorVersion */ - lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMajorVersion); - /* MinorVersion */ - lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMinorVersion); - /* IssueInstant */ - time = lasso_get_current_time(); - lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request), - time); - xmlFree(time); - /* ProviderID */ - lasso_lib_name_identifier_mapping_request_set_providerID(LASSO_LIB_NAME_IDENTIFIER_MAPPING_REQUEST(request), - providerID); - - /* NameIdentifier */ - identifier = lasso_saml_name_identifier_new(nameIdentifier); - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(identifier), - nameQualifier); - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(identifier), - format); - - lasso_lib_name_identifier_mapping_request_set_nameIdentifier(LASSO_LIB_NAME_IDENTIFIER_MAPPING_REQUEST(request), - LASSO_SAML_NAME_IDENTIFIER(identifier)); - lasso_node_destroy(identifier); - - /* Target name space */ - lasso_lib_name_identifier_mapping_request_set_targetNameSpace(LASSO_LIB_NAME_IDENTIFIER_MAPPING_REQUEST(request), - targetNameSpace); - - return request; -} - -static LassoNode * -lasso_name_identifier_mapping_request_new_from_soap(const gchar *buffer) -{ - LassoNode *request; - LassoNode *envelope, *lassoNode_request; - xmlNodePtr xmlNode_request; - LassoNodeClass *class; - - envelope = lasso_node_new_from_dump(buffer); - if (LASSO_IS_NODE(envelope) == FALSE) { - return NULL; - } - - request = LASSO_NODE(g_object_new(LASSO_TYPE_NAME_IDENTIFIER_MAPPING_REQUEST, NULL)); - lassoNode_request = lasso_node_get_child(envelope, "NameIdentifierMappingRequest", - lassoLibHRef, NULL); - class = LASSO_NODE_GET_CLASS(lassoNode_request); - xmlNode_request = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_request)), 1); - lasso_node_destroy(lassoNode_request); - class = LASSO_NODE_GET_CLASS(request); - class->set_xmlNode(LASSO_NODE(request), xmlNode_request); - lasso_node_destroy(envelope); - - return request; -} - -static LassoNode * -lasso_name_identifier_mapping_request_new_from_xml(gchar *buffer) -{ - LassoNode *request; - LassoNode *lassoNode_request; - xmlNodePtr xmlNode_request; - LassoNodeClass *class; - - request = LASSO_NODE(g_object_new(LASSO_TYPE_NAME_IDENTIFIER_MAPPING_REQUEST, NULL)); - - lassoNode_request = lasso_node_new_from_dump(buffer); - class = LASSO_NODE_GET_CLASS(lassoNode_request); - xmlNode_request = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_request)), 1); - class = LASSO_NODE_GET_CLASS(request); - class->set_xmlNode(LASSO_NODE(request), xmlNode_request); - lasso_node_destroy(lassoNode_request); - - return request; -} - -LassoNode* -lasso_name_identifier_mapping_request_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *request = NULL; - - g_return_val_if_fail(buffer != NULL, NULL); - - switch(export_type){ - case lassoNodeExportTypeSoap: - request = lasso_name_identifier_mapping_request_new_from_soap(buffer); - break; - case lassoNodeExportTypeXml: - request = lasso_name_identifier_mapping_request_new_from_xml(buffer); - break; - default: - message(G_LOG_LEVEL_CRITICAL, "Unsupported export type\n"); - break; - } - - return request; -} diff --git a/lasso/Attic/protocols/name_identifier_mapping_request.h b/lasso/Attic/protocols/name_identifier_mapping_request.h deleted file mode 100644 index df66c81c..00000000 --- a/lasso/Attic/protocols/name_identifier_mapping_request.h +++ /dev/null @@ -1,72 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_NAME_IDENTIFIER_MAPPING_REQUEST_H__ -#define __LASSO_NAME_IDENTIFIER_MAPPING_REQUEST_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include - -#define LASSO_TYPE_NAME_IDENTIFIER_MAPPING_REQUEST (lasso_name_identifier_mapping_request_get_type()) -#define LASSO_NAME_IDENTIFIER_MAPPING_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_NAME_IDENTIFIER_MAPPING_REQUEST, LassoNameIdentifierMappingRequest)) -#define LASSO_NAME_IDENTIFIER_MAPPING_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_NAME_IDENTIFIER_MAPPING_REQUEST, LassoNameIdentifierMappingRequestClass)) -#define LASSO_IS_NAME_IDENTIFIER_MAPPING_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_NAME_IDENTIFIER_MAPPING_REQUEST)) -#define LASSO_IS_NAME_IDENTIFIER_MAPPING_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_NAME_IDENTIFIER_MAPPING_REQUEST)) -#define LASSO_NAME_IDENTIFIER_MAPPING_REQUEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_NAME_IDENTIFIER_MAPPING_REQUEST, LassoNameIdentifierMappingRequestClass)) - -typedef struct _LassoNameIdentifierMappingRequest LassoNameIdentifierMappingRequest; -typedef struct _LassoNameIdentifierMappingRequestClass LassoNameIdentifierMappingRequestClass; - -struct _LassoNameIdentifierMappingRequest { - LassoLibNameIdentifierMappingRequest parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoNameIdentifierMappingRequestClass { - LassoLibNameIdentifierMappingRequestClass parent; -}; - -LASSO_EXPORT GType lasso_name_identifier_mapping_request_get_type (void); - -LASSO_EXPORT LassoNode *lasso_name_identifier_mapping_request_new (const xmlChar *providerID, - const xmlChar *nameIdentifier, - const xmlChar *nameQualifier, - const xmlChar *format, - const xmlChar *targetNameSpace, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method); - -LASSO_EXPORT LassoNode* lasso_name_identifier_mapping_request_new_from_export (gchar *buffer, - lassoNodeExportType export_type); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_NAME_IDENTIFIER_MAPPING_REQUEST_H__ */ diff --git a/lasso/Attic/protocols/name_identifier_mapping_response.c b/lasso/Attic/protocols/name_identifier_mapping_response.c deleted file mode 100644 index 3137d35e..00000000 --- a/lasso/Attic/protocols/name_identifier_mapping_response.c +++ /dev/null @@ -1,228 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -gint -lasso_name_identifier_mapping_response_set_status_code_value(LassoNameIdentifierMappingResponse *response, - xmlChar *statusCodeValue) -{ - LassoNode *status, *status_code; - - g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING_RESPONSE(response), -1); - - status = lasso_samlp_status_new(); - - status_code = lasso_samlp_status_code_new(); - lasso_samlp_status_code_set_value(LASSO_SAMLP_STATUS_CODE(status_code), - statusCodeValue); - - lasso_samlp_status_set_statusCode(LASSO_SAMLP_STATUS(status), - LASSO_SAMLP_STATUS_CODE(status_code)); - - lasso_lib_name_identifier_mapping_response_set_status(LASSO_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(response), - LASSO_SAMLP_STATUS(status)); - lasso_node_destroy(status_code); - lasso_node_destroy(status); - - return 0; -} - -/*****************************************************************************/ -/* private methods */ -/*****************************************************************************/ - -static LassoNode * -lasso_name_identifier_mapping_response_new_from_soap(const gchar *buffer) -{ - LassoNode *response; - LassoNode *envelope, *lassoNode_response; - xmlNodePtr xmlNode_response; - LassoNodeClass *class; - - envelope = lasso_node_new_from_dump(buffer); - if (LASSO_IS_NODE(envelope) == FALSE) { - return NULL; - } - - response = LASSO_NODE(g_object_new(LASSO_TYPE_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL)); - lassoNode_response = lasso_node_get_child(envelope, "NameIdentifierMappingResponse", - lassoLibHRef, NULL); - class = LASSO_NODE_GET_CLASS(lassoNode_response); - xmlNode_response = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_response)), 1); - lasso_node_destroy(lassoNode_response); - class = LASSO_NODE_GET_CLASS(response); - class->set_xmlNode(LASSO_NODE(response), xmlNode_response); - lasso_node_destroy(envelope); - - return response; -} - - -static LassoNode * -lasso_name_identifier_mapping_response_new_from_xml(gchar *buffer) -{ - LassoNode *response; - LassoNode *lassoNode_response; - xmlNodePtr xmlNode_response; - LassoNodeClass *class; - - response = LASSO_NODE(g_object_new(LASSO_TYPE_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL)); - - lassoNode_response = lasso_node_new_from_dump(buffer); - class = LASSO_NODE_GET_CLASS(lassoNode_response); - xmlNode_response = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_response)), 1); - class = LASSO_NODE_GET_CLASS(response); - class->set_xmlNode(LASSO_NODE(response), xmlNode_response); - lasso_node_destroy(lassoNode_response); - - return response; -} - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_name_identifier_mapping_response_instance_init(LassoNameIdentifierMappingResponse *response) -{ -} - -static void -lasso_name_identifier_mapping_response_class_init(LassoNameIdentifierMappingResponseClass *class) -{ -} - -GType lasso_name_identifier_mapping_response_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoNameIdentifierMappingResponseClass), - NULL, - NULL, - (GClassInitFunc) lasso_name_identifier_mapping_response_class_init, - NULL, - NULL, - sizeof(LassoNameIdentifierMappingResponse), - 0, - (GInstanceInitFunc) lasso_name_identifier_mapping_response_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE, - "LassoNameIdentifierMappingResponse", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_name_identifier_mapping_response_new(const xmlChar *providerID, - const xmlChar *statusCodeValue, - LassoNode *request, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method) -{ - LassoNode *response, *ss, *ssc; - xmlChar *inResponseTo, *request_providerID; - xmlChar *id, *time; - - response = LASSO_NODE(g_object_new(LASSO_TYPE_NAME_IDENTIFIER_MAPPING_RESPONSE, NULL)); - - /* ResponseID */ - id = lasso_build_unique_id(32); - lasso_samlp_response_abstract_set_responseID(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - id); - xmlFree(id); - /* MajorVersion */ - lasso_samlp_response_abstract_set_majorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - lassoLibMajorVersion); - /* MinorVersion */ - lasso_samlp_response_abstract_set_minorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - lassoLibMinorVersion); - /* IssueInstant */ - time = lasso_get_current_time(); - lasso_samlp_response_abstract_set_issueInstant(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - time); - xmlFree(time); - - /* ProviderID */ - lasso_lib_name_identifier_mapping_response_set_providerID(LASSO_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(response), - providerID); - - /* InResponseTo */ - inResponseTo = lasso_node_get_attr_value(request, "RequestID", NULL); - lasso_samlp_response_abstract_set_inResponseTo(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - inResponseTo); - xmlFree(inResponseTo); - - /* Recipient */ - request_providerID = lasso_node_get_child_content(request, "ProviderID", NULL, NULL); - lasso_samlp_response_abstract_set_recipient(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - request_providerID); - xmlFree(request_providerID); - - /* Status / StatusCode / Value */ - ss = lasso_samlp_status_new(); - ssc = lasso_samlp_status_code_new(); - lasso_samlp_status_code_set_value(LASSO_SAMLP_STATUS_CODE(ssc), - statusCodeValue); - lasso_samlp_status_set_statusCode(LASSO_SAMLP_STATUS(ss), - LASSO_SAMLP_STATUS_CODE(ssc)); - - lasso_lib_name_identifier_mapping_response_set_status(LASSO_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(response), - LASSO_SAMLP_STATUS(ss)); - lasso_node_destroy(ssc); - lasso_node_destroy(ss); - - return response; -} - -LassoNode* -lasso_name_identifier_mapping_response_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *response; - - g_return_val_if_fail(buffer != NULL, NULL); - - switch(export_type){ - case lassoNodeExportTypeSoap: - response = lasso_name_identifier_mapping_response_new_from_soap(buffer); - break; - case lassoNodeExportTypeXml: - response = lasso_name_identifier_mapping_response_new_from_xml(buffer); - break; - default: - message(G_LOG_LEVEL_WARNING, "Invalid export type\n"); - return NULL; - } - - return response; -} diff --git a/lasso/Attic/protocols/name_identifier_mapping_response.h b/lasso/Attic/protocols/name_identifier_mapping_response.h deleted file mode 100644 index 529d9097..00000000 --- a/lasso/Attic/protocols/name_identifier_mapping_response.h +++ /dev/null @@ -1,74 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_NAME_IDENTIFIER_MAPPING_RESPONSE_H__ -#define __LASSO_NAME_IDENTIFIER_MAPPING_RESPONSE_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include - -#define LASSO_TYPE_NAME_IDENTIFIER_MAPPING_RESPONSE (lasso_name_identifier_mapping_response_get_type()) -#define LASSO_NAME_IDENTIFIER_MAPPING_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_NAME_IDENTIFIER_MAPPING_RESPONSE, LassoNameIdentifierMappingResponse)) -#define LASSO_NAME_IDENTIFIER_MAPPING_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_NAME_IDENTIFIER_MAPPING_RESPONSE, LassoNameIdentifierMappingResponseClass)) -#define LASSO_IS_NAME_IDENTIFIER_MAPPING_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_NAME_IDENTIFIER_MAPPING_RESPONSE)) -#define LASSO_IS_NAME_IDENTIFIER_MAPPING_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_NAME_IDENTIFIER_MAPPING_RESPONSE)) -#define LASSO_NAME_IDENTIFIER_MAPPING_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_NAME_IDENTIFIER_MAPPING_RESPONSE, LassoNameIdentifierMappingResponseClass)) - -typedef struct _LassoNameIdentifierMappingResponse LassoNameIdentifierMappingResponse; -typedef struct _LassoNameIdentifierMappingResponseClass LassoNameIdentifierMappingResponseClass; - -struct _LassoNameIdentifierMappingResponse { - LassoLibNameIdentifierMappingResponse parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoNameIdentifierMappingResponseClass { - LassoLibNameIdentifierMappingResponseClass parent; -}; - -LASSO_EXPORT GType lasso_name_identifier_mapping_response_get_type (void); - -LASSO_EXPORT LassoNode* lasso_name_identifier_mapping_response_new (const xmlChar *providerID, - const xmlChar *statusCodeValue, - LassoNode *request, - lassoSignatureType sign_type, - lassoSignatureMethod sign_method); - -LASSO_EXPORT LassoNode* lasso_name_identifier_mapping_response_new_from_export (gchar *buffer, - lassoNodeExportType export_type); - -LASSO_EXPORT gint lasso_name_identifier_mapping_response_set_status_code_value (LassoNameIdentifierMappingResponse *response, - xmlChar *statusCodeValue); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_NAME_IDENTIFIER_MAPPING_RESPONSE_H__ */ diff --git a/lasso/Attic/protocols/protocols.c b/lasso/Attic/protocols/protocols.c deleted file mode 100644 index ee60978e..00000000 --- a/lasso/Attic/protocols/protocols.c +++ /dev/null @@ -1,26 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include diff --git a/lasso/Attic/protocols/protocols.h b/lasso/Attic/protocols/protocols.h deleted file mode 100644 index 335c4f3e..00000000 --- a/lasso/Attic/protocols/protocols.h +++ /dev/null @@ -1,39 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_PROTOCOLS_H__ -#define __LASSO_PROTOCOLS_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#include - -#endif /* __LASSO_PROTOCOLS_H__ */ diff --git a/lasso/Attic/protocols/provider.c b/lasso/Attic/protocols/provider.c deleted file mode 100644 index 2ccc5569..00000000 --- a/lasso/Attic/protocols/provider.c +++ /dev/null @@ -1,732 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -struct _LassoProviderPrivate -{ - gboolean dispose_has_run; -}; - -static GObjectClass *parent_class = NULL; - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -LassoProvider* -lasso_provider_copy(LassoProvider *provider) -{ - LassoProvider *copy; - - g_return_val_if_fail(LASSO_IS_PROVIDER(provider), NULL); - - copy = LASSO_PROVIDER(g_object_new(LASSO_TYPE_PROVIDER, NULL)); - copy->metadata = lasso_node_copy(provider->metadata); - copy->public_key = g_strdup(provider->public_key); - copy->ca_cert_chain = g_strdup(provider->ca_cert_chain); - - return copy; -} - -void -lasso_provider_destroy(LassoProvider *provider) -{ - g_object_unref(G_OBJECT(provider)); -} - -gchar * -lasso_provider_dump(LassoProvider *provider) -{ - LassoNode *provider_node, *metadata_node; - LassoNodeClass *provider_class; - gchar *provider_dump; - - provider_node = lasso_node_new(); - - /* set the public key, ca_cert_chain, metadata */ - provider_class = LASSO_NODE_GET_CLASS(provider_node); - provider_class->set_name(provider_node, LASSO_PROVIDER_NODE); - provider_class->set_ns(provider_node, lassoLassoHRef, NULL); - - metadata_node = lasso_node_copy(provider->metadata); - provider_class->add_child(provider_node, metadata_node, FALSE); - lasso_node_destroy(metadata_node); - if(provider->public_key != NULL) { - provider_class->set_prop(provider_node, LASSO_PROVIDER_PUBLIC_KEY_NODE, - provider->public_key); - } - if(provider->ca_cert_chain != NULL) { - provider_class->set_prop(provider_node, LASSO_PROVIDER_CA_CERT_CHAIN_NODE, - provider->ca_cert_chain); - } - provider_dump = lasso_node_export(provider_node); - - lasso_node_destroy(provider_node); - - return provider_dump; -} - -gchar * -lasso_provider_get_metadata_value(LassoProvider *provider, - lassoProviderType provider_type, - gchar *name, - GError **err) -{ - xmlChar *content; - LassoNode *descriptor; - GError *tmp_err = NULL; - gchar *result = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - if (LASSO_IS_PROVIDER(provider) == FALSE) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ, - lasso_strerror(LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ)); - g_return_val_if_fail(LASSO_IS_PROVIDER(provider), NULL); - } - if (name == NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_INVALID_VALUE, - lasso_strerror(LASSO_PARAM_ERROR_INVALID_VALUE)); - g_return_val_if_fail(name != NULL, NULL); - } - - switch (provider_type) { - case lassoProviderTypeSp: - descriptor = lasso_node_get_child(provider->metadata, - "SPDescriptor", NULL, &tmp_err); - break; - case lassoProviderTypeIdp: - descriptor = lasso_node_get_child(provider->metadata, - "IDPDescriptor", NULL, &tmp_err); - break; - default: - descriptor = NULL; - break; - } - if (descriptor == NULL) { - g_propagate_error (err, tmp_err); - return NULL; - } - - content = lasso_node_get_child_content(descriptor, name, NULL, &tmp_err); - lasso_node_destroy(descriptor); - - if (content == NULL) { - g_propagate_error (err, tmp_err); - } else { - result = g_strdup(g_strstrip(content)); - xmlFree(content); - } - - return result; -} - -gchar * -lasso_provider_get_assertionConsumerServiceURL(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "AssertionConsumerServiceURL", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_authnRequestsSigned(LassoProvider *provider, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - lassoProviderTypeSp, - "AuthnRequestsSigned", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_federationTerminationNotificationProtocolProfile(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "FederationTerminationNotificationProtocolProfile", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_federationTerminationServiceReturnURL(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "FederationTerminationServiceReturnURL", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_federationTerminationServiceURL(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "FederationTerminationServiceURL", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_nameIdentifierMappingProtocolProfile(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "NameIdentifierMappingProtocolProfile", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_providerID(LassoProvider *provider) -{ - LassoNode *descriptor; - xmlChar *value; - GError *err = NULL; - - descriptor = lasso_node_get_child(provider->metadata, - "EntityDescriptor", NULL, &err); - if (descriptor == NULL) { - message(G_LOG_LEVEL_CRITICAL, err->message); - g_error_free(err); - return NULL; - } - - value = lasso_node_get_attr_value(descriptor, "providerID", &err); - lasso_node_destroy(descriptor); - - if (value == NULL) { - /* providerID attr is required */ - message(G_LOG_LEVEL_CRITICAL, err->message); - g_error_free(err); - } - - return value; -} - -gchar * -lasso_provider_get_registerNameIdentifierProtocolProfile(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "RegisterNameIdentifierProtocolProfile", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_registerNameIdentifierServiceURL(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "RegisterNameIdentifierServiceURL", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar* -lasso_provider_get_registerNameIdentifierServiceReturnURL(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "RegisterNameIdentifierServiceReturnURL", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_singleSignOnProtocolProfile(LassoProvider *provider, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - lassoProviderTypeIdp, - "SingleSignOnProtocolProfile", - &tmp_err); - if (tmp_err != NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_singleSignOnServiceURL(LassoProvider *provider, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - lassoProviderTypeIdp, - "SingleSignOnServiceURL", - &tmp_err); - if (tmp_err != NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_singleLogoutProtocolProfile(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "SingleLogoutProtocolProfile", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_singleLogoutServiceURL(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "SingleLogoutServiceURL", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_singleLogoutServiceReturnURL(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "SingleLogoutServiceReturnURL", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -gchar * -lasso_provider_get_soapEndpoint(LassoProvider *provider, - lassoProviderType provider_type, - GError **err) -{ - xmlChar *value; - GError *tmp_err = NULL; - - if (err != NULL && *err != NULL) { - g_set_error(err, g_quark_from_string("Lasso"), - LASSO_PARAM_ERROR_CHECK_FAILED, - lasso_strerror(LASSO_PARAM_ERROR_CHECK_FAILED)); - g_return_val_if_fail (err == NULL || *err == NULL, NULL); - } - - value = lasso_provider_get_metadata_value(provider, - provider_type, - "SoapEndpoint", - &tmp_err); - if (value == NULL) { - g_propagate_error (err, tmp_err); - } - - return value; -} - -void -lasso_provider_set_public_key(LassoProvider *provider, - gchar *public_key) -{ - provider->public_key = g_strdup(public_key); -} - -void -lasso_provider_set_ca_cert_chain(LassoProvider *provider, - gchar *ca_cert_chain) -{ - provider->ca_cert_chain = g_strdup(ca_cert_chain); -} - -/*****************************************************************************/ -/* private methods */ -/*****************************************************************************/ - -static gchar *lasso_provider_get_direct_child_content(LassoProvider *provider, - const gchar *name) -{ - LassoNode *node; - xmlChar *content; - - node = lasso_node_get_child(LASSO_NODE(provider), name, NULL, NULL); - if(node == NULL) { - return NULL; - } - content = lasso_node_get_content(node, NULL); - lasso_node_destroy(node); - - return content; -} - -/*****************************************************************************/ -/* overrided parent class methods */ -/*****************************************************************************/ - -static void -lasso_provider_dispose(LassoProvider *provider) -{ - if (provider->private->dispose_has_run) { - return; - } - provider->private->dispose_has_run = TRUE; - - debug("Provider object 0x%x disposed ...\n", provider); - - /* unref reference counted objects */ - lasso_node_destroy(provider->metadata); - - parent_class->dispose(G_OBJECT(provider)); -} - -static void -lasso_provider_finalize(LassoProvider *provider) -{ - debug("Provider object 0x%x finalized ...\n", provider); - - g_free(provider->public_key); - g_free(provider->ca_cert_chain); - g_free(provider->private); - - parent_class->finalize(G_OBJECT(provider)); -} - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_provider_instance_init(LassoProvider *provider) -{ - provider->private = g_new (LassoProviderPrivate, 1); - provider->private->dispose_has_run = FALSE; - provider->metadata = NULL; - provider->public_key = NULL; - provider->ca_cert_chain = NULL; -} - -static void -lasso_provider_class_init(LassoProviderClass *class) { - GObjectClass *gobject_class = G_OBJECT_CLASS(class); - - parent_class = g_type_class_peek_parent(class); - /* override parent class methods */ - gobject_class->dispose = (void *)lasso_provider_dispose; - gobject_class->finalize = (void *)lasso_provider_finalize; -} - -GType lasso_provider_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoProviderClass), - NULL, - NULL, - (GClassInitFunc) lasso_provider_class_init, - NULL, - NULL, - sizeof(LassoProvider), - 0, - (GInstanceInitFunc) lasso_provider_instance_init, - }; - - this_type = g_type_register_static(G_TYPE_OBJECT, - "LassoProvider", - &this_info, 0); - } - return this_type; -} - -LassoProvider* -lasso_provider_new(gchar *metadata, - gchar *public_key, - gchar *ca_cert_chain) -{ - LassoProvider *provider; - - provider = lasso_provider_new_metadata_filename(metadata); - if (provider != NULL) { - provider->public_key = g_strdup(public_key); - provider->ca_cert_chain = g_strdup(ca_cert_chain); - } - - return provider; -} - - -LassoProvider* -lasso_provider_new_from_metadata_node(LassoNode *metadata_node) -{ - LassoProvider *provider; - - provider = LASSO_PROVIDER(g_object_new(LASSO_TYPE_PROVIDER, NULL)); - provider->metadata = lasso_node_copy(metadata_node); - - return provider; -} - -LassoProvider* -lasso_provider_new_metadata_filename(gchar *metadata_filename) -{ - LassoProvider *provider = NULL; - xmlDocPtr doc; - xmlNodePtr root; - - doc = xmlParseFile(metadata_filename); - if (doc != NULL) { - /* get root element of doc and duplicate it */ - root = xmlCopyNode(xmlDocGetRootElement(doc), 1); - xmlFreeDoc(doc); - - provider = LASSO_PROVIDER(g_object_new(LASSO_TYPE_PROVIDER, NULL)); - provider->metadata = lasso_node_new(); - LASSO_NODE_GET_CLASS(provider->metadata)->set_xmlNode(provider->metadata, root); - } - else { - message(G_LOG_LEVEL_CRITICAL, - "Failed to build LassoProvider: invalid metadata file.\n"); - } - - return provider; -} diff --git a/lasso/Attic/protocols/provider.h b/lasso/Attic/protocols/provider.h deleted file mode 100644 index 71c11973..00000000 --- a/lasso/Attic/protocols/provider.h +++ /dev/null @@ -1,157 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_PROVIDER_H__ -#define __LASSO_PROVIDER_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include - -#define LASSO_TYPE_PROVIDER (lasso_provider_get_type()) -#define LASSO_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_PROVIDER, LassoProvider)) -#define LASSO_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_PROVIDER, LassoProviderClass)) -#define LASSO_IS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_PROVIDER)) -#define LASSO_IS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_PROVIDER)) -#define LASSO_PROVIDER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_PROVIDER, LassoProviderClass)) - -#define LASSO_PROVIDER_NODE "Provider" -#define LASSO_PROVIDER_PUBLIC_KEY_NODE "PublicKey" -#define LASSO_PROVIDER_CA_CERT_CHAIN_NODE "CaCertChain" - -typedef struct _LassoProvider LassoProvider; -typedef struct _LassoProviderClass LassoProviderClass; -typedef struct _LassoProviderPrivate LassoProviderPrivate; - -typedef enum { - lassoProviderTypeNone = 0, - lassoProviderTypeSp, - lassoProviderTypeIdp -} lassoProviderType; - -struct _LassoProvider { - GObject parent; - - LassoNode *metadata; - - gchar *public_key; - gchar *ca_cert_chain; - - /*< private >*/ - LassoProviderPrivate *private; -}; - -struct _LassoProviderClass { - GObjectClass parent; -}; - -LASSO_EXPORT GType lasso_provider_get_type (void); - -LASSO_EXPORT LassoProvider* lasso_provider_new (gchar *metadata, - gchar *public_key, - gchar *ca_cert_chain); - -LASSO_EXPORT LassoProvider* lasso_provider_new_from_metadata_node (LassoNode *metadata_node); - -LASSO_EXPORT LassoProvider* lasso_provider_new_metadata_filename (gchar *metadata_filename); - -LASSO_EXPORT LassoProvider* lasso_provider_copy (LassoProvider *provider); - -LASSO_EXPORT void lasso_provider_destroy (LassoProvider *provider); - -LASSO_EXPORT gchar* lasso_provider_dump (LassoProvider *provider); - -LASSO_EXPORT gchar* lasso_provider_get_assertionConsumerServiceURL (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_authnRequestsSigned (LassoProvider *provider, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_federationTerminationNotificationProtocolProfile (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_federationTerminationServiceReturnURL (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_federationTerminationServiceURL (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_nameIdentifierMappingProtocolProfile (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_providerID (LassoProvider *provider); - -LASSO_EXPORT gchar* lasso_provider_get_registerNameIdentifierProtocolProfile (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_registerNameIdentifierServiceURL (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_registerNameIdentifierServiceReturnURL (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_singleSignOnProtocolProfile (LassoProvider *provider, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_singleSignOnServiceURL (LassoProvider *provider, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_singleLogoutProtocolProfile (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_singleLogoutServiceURL (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_singleLogoutServiceReturnURL (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT gchar* lasso_provider_get_soapEndpoint (LassoProvider *provider, - lassoProviderType provider_type, - GError **err); - -LASSO_EXPORT void lasso_provider_set_public_key (LassoProvider *provider, - gchar *public_key); - -LASSO_EXPORT void lasso_provider_set_ca_cert_chain (LassoProvider *provider, - gchar *ca_cert_chain); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_PROVIDER_H__ */ diff --git a/lasso/Attic/protocols/register_name_identifier_request.c b/lasso/Attic/protocols/register_name_identifier_request.c deleted file mode 100644 index 729ab3cc..00000000 --- a/lasso/Attic/protocols/register_name_identifier_request.c +++ /dev/null @@ -1,356 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -void -lasso_register_name_identifier_request_rename_attributes_for_query(LassoRegisterNameIdentifierRequest *request) - -{ - LassoNode *idpidentifier, *spidentifier, *oldidentifier; - - g_return_if_fail (LASSO_IS_REGISTER_NAME_IDENTIFIER_REQUEST(request)); - - idpidentifier = lasso_node_get_child(LASSO_NODE(request), "IDPProvidedNameIdentifier", - NULL, NULL); - lasso_node_rename_prop(idpidentifier, "NameQualifier", "IDPNameQualifier"); - lasso_node_rename_prop(idpidentifier, "Format", "IDPFormat"); - lasso_node_destroy(idpidentifier); - - spidentifier = lasso_node_get_child(LASSO_NODE(request), "SPProvidedNameIdentifier", - NULL, NULL); - if (spidentifier != NULL) { - lasso_node_rename_prop(spidentifier, "NameQualifier", "SPNameQualifier"); - lasso_node_rename_prop(spidentifier, "Format", "SPFormat"); - lasso_node_destroy(spidentifier); - } - - oldidentifier = lasso_node_get_child(LASSO_NODE(request), "OldProvidedNameIdentifier", - NULL, NULL); - lasso_node_rename_prop(oldidentifier, "NameQualifier", "OldNameQualifier"); - lasso_node_rename_prop(oldidentifier, "Format", "OldFormat"); - lasso_node_destroy(oldidentifier); -} - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_register_name_identifier_request_instance_init(LassoRegisterNameIdentifierRequest *request) -{ -} - -static void -lasso_register_name_identifier_request_class_init(LassoRegisterNameIdentifierRequestClass *class) -{ -} - -GType lasso_register_name_identifier_request_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoRegisterNameIdentifierRequestClass), - NULL, - NULL, - (GClassInitFunc) lasso_register_name_identifier_request_class_init, - NULL, - NULL, - sizeof(LassoRegisterNameIdentifierRequest), - 0, - (GInstanceInitFunc) lasso_register_name_identifier_request_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_REQUEST, - "LassoRegisterNameIdentifierRequest", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_register_name_identifier_request_new(const xmlChar *providerID, - const xmlChar *idpProvidedNameIdentifier, - const xmlChar *idpNameQualifier, - const xmlChar *idpFormat, - const xmlChar *spProvidedNameIdentifier, - const xmlChar *spNameQualifier, - const xmlChar *spFormat, - const xmlChar *oldProvidedNameIdentifier, - const xmlChar *oldNameQualifier, - const xmlChar *oldFormat) -{ - LassoNode *request, *idpidentifier, *spidentifier, *oldidentifier; - xmlChar *id, *time; - - request = LASSO_NODE(g_object_new(LASSO_TYPE_REGISTER_NAME_IDENTIFIER_REQUEST, NULL)); - - /* Set ONLY required elements/attributes */ - /* RequestID */ - id = lasso_build_unique_id(32); - lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), - id); - xmlFree(id); - /* MajorVersion */ - lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMajorVersion); - /* MinorVersion */ - lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoLibMinorVersion); - /* IssueInstant */ - time = lasso_get_current_time(); - lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request), - time); - xmlFree(time); - /* ProviderID */ - lasso_lib_register_name_identifier_request_set_providerID(LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(request), - providerID); - - /* idp provided name identifier is required */ - idpidentifier = lasso_lib_idp_provided_name_identifier_new(idpProvidedNameIdentifier); - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(idpidentifier), idpNameQualifier); - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(idpidentifier), idpFormat); - lasso_lib_register_name_identifier_request_set_idpProvidedNameIdentifier(LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(request), - LASSO_LIB_IDP_PROVIDED_NAME_IDENTIFIER(idpidentifier)); - lasso_node_destroy(idpidentifier); - - /* old provided name identifier is required */ - oldidentifier = lasso_lib_old_provided_name_identifier_new(oldProvidedNameIdentifier); - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(oldidentifier), oldNameQualifier); - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(oldidentifier), oldFormat); - lasso_lib_register_name_identifier_request_set_oldProvidedNameIdentifier(LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(request), - LASSO_LIB_OLD_PROVIDED_NAME_IDENTIFIER(oldidentifier)); - lasso_node_destroy(oldidentifier); - - /* sp provided name identifier is optional */ - if (spProvidedNameIdentifier != NULL && spNameQualifier != NULL && spFormat != NULL) { - spidentifier = lasso_lib_sp_provided_name_identifier_new(spProvidedNameIdentifier); - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(spidentifier), spNameQualifier); - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(spidentifier), spFormat); - lasso_lib_register_name_identifier_request_set_spProvidedNameIdentifier(LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(request), - LASSO_LIB_SP_PROVIDED_NAME_IDENTIFIER(spidentifier)); - lasso_node_destroy(spidentifier); - } - - return request; -} - -static LassoNode * -lasso_register_name_identifier_request_new_from_query(const xmlChar *query) -{ - LassoNode *request, *idpidentifier, *spidentifier, *oldidentifier; - xmlChar *str; - GData *gd; - - request = LASSO_NODE(g_object_new(LASSO_TYPE_REGISTER_NAME_IDENTIFIER_REQUEST, NULL)); - - gd = lasso_query_to_dict(query); - - /* RequestID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "RequestID"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), str); - - /* MajorVersion */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MajorVersion"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), str); - - /* MinorVersion */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MinorVersion"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), str); - - /* IssueInstant */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "IssueInstant"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request), str); - - /* ProviderID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "ProviderID"), 0); if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_lib_register_name_identifier_request_set_providerID(LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(request), str); - - /* RelayState */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "RelayState"), 0); - if (str != NULL) - lasso_lib_register_name_identifier_request_set_relayState(LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(request), str); - - /* IDPProvidedNameIdentifier */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "IDPProvidedNameIdentifier"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - idpidentifier = lasso_lib_idp_provided_name_identifier_new(str); - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "IDPNameQualifier"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(idpidentifier), str); - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "IDPFormat"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(idpidentifier), str); - - lasso_lib_register_name_identifier_request_set_idpProvidedNameIdentifier(LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(request), - LASSO_LIB_IDP_PROVIDED_NAME_IDENTIFIER(idpidentifier)); - lasso_node_destroy(idpidentifier); - - /* OldPProvidedNameIdentifier */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "OldProvidedNameIdentifier"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - oldidentifier = lasso_lib_old_provided_name_identifier_new(str); - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "OldNameQualifier"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(oldidentifier), str); - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "OldFormat"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(oldidentifier), str); - - lasso_lib_register_name_identifier_request_set_oldProvidedNameIdentifier(LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(request), - LASSO_LIB_OLD_PROVIDED_NAME_IDENTIFIER(oldidentifier)); - lasso_node_destroy(oldidentifier); - - /* SPPProvidedNameIdentifier ( optional ) */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "SPProvidedNameIdentifier"), 0); - if (str != NULL) { - spidentifier = lasso_lib_sp_provided_name_identifier_new(str); - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "SPNameQualifier"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(spidentifier), str); - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "SPFormat"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(request); - return NULL; - } - lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(spidentifier), str); - - lasso_lib_register_name_identifier_request_set_spProvidedNameIdentifier(LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(request), - LASSO_LIB_SP_PROVIDED_NAME_IDENTIFIER(spidentifier)); - lasso_node_destroy(spidentifier); - } - - - g_datalist_clear(&gd); - - return request; -} - -static LassoNode * -lasso_register_name_identifier_request_new_from_soap(const xmlChar *buffer) -{ - LassoNode *request; - LassoNode *envelope, *lassoNode_request; - xmlNodePtr xmlNode_request; - LassoNodeClass *class; - - envelope = lasso_node_new_from_dump(buffer); - if (LASSO_IS_NODE(envelope) == FALSE) { - return NULL; - } - - request = LASSO_NODE(g_object_new(LASSO_TYPE_REGISTER_NAME_IDENTIFIER_REQUEST, NULL)); - lassoNode_request = lasso_node_get_child(envelope, "RegisterNameIdentifierRequest", - lassoLibHRef, NULL); - class = LASSO_NODE_GET_CLASS(lassoNode_request); - xmlNode_request = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_request)), 1); - lasso_node_destroy(lassoNode_request); - class = LASSO_NODE_GET_CLASS(request); - class->set_xmlNode(LASSO_NODE(request), xmlNode_request); - lasso_node_destroy(envelope); - - return request; -} - -LassoNode* -lasso_register_name_identifier_request_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *request; - - g_return_val_if_fail(buffer != NULL, NULL); - - switch(export_type){ - case lassoNodeExportTypeQuery: - request = lasso_register_name_identifier_request_new_from_query(buffer); - break; - case lassoNodeExportTypeSoap: - request = lasso_register_name_identifier_request_new_from_soap(buffer); - break; - default: - message(G_LOG_LEVEL_WARNING, "Invalid export type\n"); - request = NULL; - } - - return request; -} diff --git a/lasso/Attic/protocols/register_name_identifier_request.h b/lasso/Attic/protocols/register_name_identifier_request.h deleted file mode 100644 index 6248153d..00000000 --- a/lasso/Attic/protocols/register_name_identifier_request.h +++ /dev/null @@ -1,78 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_REGISTER_NAME_IDENTIFIER_REQUEST_H__ -#define __LASSO_REGISTER_NAME_IDENTIFIER_REQUEST_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include - -#define LASSO_TYPE_REGISTER_NAME_IDENTIFIER_REQUEST (lasso_register_name_identifier_request_get_type()) -#define LASSO_REGISTER_NAME_IDENTIFIER_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_REGISTER_NAME_IDENTIFIER_REQUEST, LassoRegisterNameIdentifierRequest)) -#define LASSO_REGISTER_NAME_IDENTIFIER_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_REGISTER_NAME_IDENTIFIER_REQUEST, LassoRegisterNameIdentifierRequestClass)) -#define LASSO_IS_REGISTER_NAME_IDENTIFIER_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_REGISTER_NAME_IDENTIFIER_REQUEST)) -#define LASSO_IS_REGISTER_NAME_IDENTIFIER_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_REGISTER_NAME_IDENTIFIER_REQUEST)) -#define LASSO_REGISTER_NAME_IDENTIFIER_REQUEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_REGISTER_NAME_IDENTIFIER_REQUEST, LassoRegisterNameIdentifierRequestClass)) - -typedef struct _LassoRegisterNameIdentifierRequest LassoRegisterNameIdentifierRequest; -typedef struct _LassoRegisterNameIdentifierRequestClass LassoRegisterNameIdentifierRequestClass; - -struct _LassoRegisterNameIdentifierRequest { - LassoLibRegisterNameIdentifierRequest parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoRegisterNameIdentifierRequestClass { - LassoLibRegisterNameIdentifierRequestClass parent; -}; - -LASSO_EXPORT GType lasso_register_name_identifier_request_get_type (void); - -LASSO_EXPORT LassoNode* lasso_register_name_identifier_request_new (const xmlChar *providerID, - const xmlChar *idpProvidedNameIdentifier, - const xmlChar *idpNameQualifier, - const xmlChar *idpFormat, - const xmlChar *spProvidedNameIdentifier, - const xmlChar *spNameQualifier, - const xmlChar *spFormat, - const xmlChar *oldProvidedNameIdentifier, - const xmlChar *oldNameQualifier, - const xmlChar *oldFormat); - -LASSO_EXPORT LassoNode* lasso_register_name_identifier_request_new_from_export (gchar *buffer, - lassoNodeExportType export_type); - -LASSO_EXPORT void lasso_register_name_identifier_request_rename_attributes_for_query (LassoRegisterNameIdentifierRequest *request); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_REGISTER_NAME_IDENTIFIER_REQUEST_H__ */ diff --git a/lasso/Attic/protocols/register_name_identifier_response.c b/lasso/Attic/protocols/register_name_identifier_response.c deleted file mode 100644 index a3780ef6..00000000 --- a/lasso/Attic/protocols/register_name_identifier_response.c +++ /dev/null @@ -1,322 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* private methods */ -/*****************************************************************************/ - -static LassoNode* -lasso_register_name_identifier_response_new_from_query(gchar *query) -{ - LassoNode *response, *ss, *ssc; - xmlChar *relayState; - xmlChar *str; - GData *gd; - - response = LASSO_NODE(g_object_new(LASSO_TYPE_REGISTER_NAME_IDENTIFIER_RESPONSE, NULL)); - - gd = lasso_query_to_dict(query); - - /* ResponseID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "ResponseID"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_samlp_response_abstract_set_responseID(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - str); - - /* MajorVersion */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MajorVersion"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_samlp_response_abstract_set_majorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - str); - - /* MinorVersion */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "MinorVersion"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_samlp_response_abstract_set_minorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - str); - - /* IssueInstant */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "IssueInstant"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_samlp_response_abstract_set_issueInstant(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - str); - - /* InResponseTo */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "InResponseTo"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_samlp_response_abstract_set_inResponseTo(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - str); - - /* Recipient */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "Recipient"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_samlp_response_abstract_set_recipient(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - str); - - /* ProviderID */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "ProviderID"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - lasso_lib_status_response_set_providerID(LASSO_LIB_STATUS_RESPONSE(response), - str); - - /* StatusCode */ - str = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "Value"), 0); - if (str == NULL) { - g_datalist_clear(&gd); - g_object_unref(response); - return NULL; - } - ss = lasso_samlp_status_new(); - ssc = lasso_samlp_status_code_new(); - lasso_samlp_status_code_set_value(LASSO_SAMLP_STATUS_CODE(ssc), - str); - lasso_samlp_status_set_statusCode(LASSO_SAMLP_STATUS(ss), - LASSO_SAMLP_STATUS_CODE(ssc)); - lasso_lib_status_response_set_status(LASSO_LIB_STATUS_RESPONSE(response), - LASSO_SAMLP_STATUS(ss)); - lasso_node_destroy(ssc); - lasso_node_destroy(ss); - - /* RelayState */ - relayState = lasso_g_ptr_array_index((GPtrArray *)g_datalist_get_data(&gd, "RelayState"), 0); - if (relayState != NULL) - lasso_lib_status_response_set_relayState(LASSO_LIB_STATUS_RESPONSE(response), relayState); - - g_datalist_clear(&gd); - - return response; -} - -static LassoNode* -lasso_register_name_identifier_response_new_from_soap(gchar *buffer) -{ - LassoNode *response; - LassoNode *envelope, *lassoNode_response; - xmlNodePtr xmlNode_response; - LassoNodeClass *class; - - response = LASSO_NODE(g_object_new(LASSO_TYPE_REGISTER_NAME_IDENTIFIER_RESPONSE, NULL)); - - envelope = lasso_node_new_from_dump(buffer); - lassoNode_response = lasso_node_get_child(envelope, "RegisterNameIdentifierResponse", - lassoLibHRef, NULL); - - class = LASSO_NODE_GET_CLASS(lassoNode_response); - xmlNode_response = xmlCopyNode(class->get_xmlNode(LASSO_NODE(lassoNode_response)), 1); - lasso_node_destroy(lassoNode_response); - - class = LASSO_NODE_GET_CLASS(response); - class->set_xmlNode(LASSO_NODE(response), xmlNode_response); - lasso_node_destroy(envelope); - - return response; -} - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_register_name_identifier_response_instance_init(LassoRegisterNameIdentifierResponse *response) -{ -} - -static void -lasso_register_name_identifier_response_class_init(LassoRegisterNameIdentifierResponseClass *class) -{ -} - -GType lasso_register_name_identifier_response_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoRegisterNameIdentifierResponseClass), - NULL, - NULL, - (GClassInitFunc) lasso_register_name_identifier_response_class_init, - NULL, - NULL, - sizeof(LassoRegisterNameIdentifierResponse), - 0, - (GInstanceInitFunc) lasso_register_name_identifier_response_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE, - "LassoRegisterNameIdentifierResponse", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_register_name_identifier_response_new(gchar *providerID, - gchar *statusCodeValue, - LassoNode *request) -{ - /* FIXME : change request type */ - LassoNode *response, *ss, *ssc; - xmlChar *inResponseTo, *request_providerID, *request_relayState; - xmlChar *id, *time; - - response = LASSO_NODE(g_object_new(LASSO_TYPE_REGISTER_NAME_IDENTIFIER_RESPONSE, NULL)); - - /* ResponseID */ - id = lasso_build_unique_id(32); - lasso_samlp_response_abstract_set_responseID(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - id); - xmlFree(id); - - /* MajorVersion */ - lasso_samlp_response_abstract_set_majorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - lassoLibMajorVersion); - - /* MinorVersion */ - lasso_samlp_response_abstract_set_minorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - lassoLibMinorVersion); - - /* IssueInstant */ - time = lasso_get_current_time(); - lasso_samlp_response_abstract_set_issueInstant(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - time); - xmlFree(time); - - /* ProviderID */ - lasso_lib_status_response_set_providerID(LASSO_LIB_STATUS_RESPONSE(response), - providerID); - - inResponseTo = lasso_node_get_attr_value(request, "RequestID", NULL); - lasso_samlp_response_abstract_set_inResponseTo(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - inResponseTo); - xmlFree(inResponseTo); - - request_providerID = lasso_node_get_child_content(request, "ProviderID", NULL, NULL); - lasso_samlp_response_abstract_set_recipient(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - request_providerID); - xmlFree(request_providerID); - - /* RelayState */ - request_relayState = lasso_node_get_child_content(request, "RelayState", NULL, NULL); - if (request_relayState != NULL) { - lasso_lib_status_response_set_relayState(LASSO_LIB_STATUS_RESPONSE(response), - request_relayState); - xmlFree(request_relayState); - } - - /* StatusCode and Value */ - ss = lasso_samlp_status_new(); - ssc = lasso_samlp_status_code_new(); - lasso_samlp_status_code_set_value(LASSO_SAMLP_STATUS_CODE(ssc), - statusCodeValue); - lasso_samlp_status_set_statusCode(LASSO_SAMLP_STATUS(ss), - LASSO_SAMLP_STATUS_CODE(ssc)); - lasso_lib_status_response_set_status(LASSO_LIB_STATUS_RESPONSE(response), - LASSO_SAMLP_STATUS(ss)); - lasso_node_destroy(ssc); - lasso_node_destroy(ss); - - return response; -} - -LassoNode* -lasso_register_name_identifier_response_new_from_request_export(gchar *buffer, - lassoNodeExportType export_type, - gchar *providerID, - gchar *statusCodeValue) -{ - LassoNode *request, *response; - - g_return_val_if_fail(buffer != NULL, NULL); - - request = lasso_register_name_identifier_request_new_from_export(buffer, export_type); - - if(request){ - message(G_LOG_LEVEL_WARNING, "Error while building RegisterNameIdentifierRequest\n"); - return NULL; - } - - response = lasso_register_name_identifier_response_new(providerID, - statusCodeValue, - request); - - return response; -} - -LassoNode* -lasso_register_name_identifier_response_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *response; - - g_return_val_if_fail(buffer != NULL, NULL); - - switch(export_type){ - case lassoNodeExportTypeQuery: - response = lasso_register_name_identifier_response_new_from_query(buffer); - break; - case lassoNodeExportTypeSoap: - response = lasso_register_name_identifier_response_new_from_soap(buffer); - break; - default: - message(G_LOG_LEVEL_WARNING, "Invalid export type\n"); - return NULL; - } - - return response; -} diff --git a/lasso/Attic/protocols/register_name_identifier_response.h b/lasso/Attic/protocols/register_name_identifier_response.h deleted file mode 100644 index 38becde4..00000000 --- a/lasso/Attic/protocols/register_name_identifier_response.h +++ /dev/null @@ -1,74 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_REGISTER_NAME_IDENTIFIER_RESPONSE_H__ -#define __LASSO_REGISTER_NAME_IDENTIFIER_RESPONSE_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include - -#define LASSO_TYPE_REGISTER_NAME_IDENTIFIER_RESPONSE (lasso_register_name_identifier_response_get_type()) -#define LASSO_REGISTER_NAME_IDENTIFIER_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_REGISTER_NAME_IDENTIFIER_RESPONSE, LassoRegisterNameIdentifierResponse)) -#define LASSO_REGISTER_NAME_IDENTIFIER_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_REGISTER_NAME_IDENTIFIER_RESPONSE, LassoRegisterNameIdentifierResponseClass)) -#define LASSO_IS_REGISTER_NAME_IDENTIFIER_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_REGISTER_NAME_IDENTIFIER_RESPONSE)) -#define LASSO_IS_REGISTER_NAME_IDENTIFIER_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_REGISTER_NAME_IDENTIFIER_RESPONSE)) -#define LASSO_REGISTER_NAME_IDENTIFIER_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_REGISTER_NAME_IDENTIFIER_RESPONSE, LassoRegisterNameIdentifierResponseClass)) - -typedef struct _LassoRegisterNameIdentifierResponse LassoRegisterNameIdentifierResponse; -typedef struct _LassoRegisterNameIdentifierResponseClass LassoRegisterNameIdentifierResponseClass; - -struct _LassoRegisterNameIdentifierResponse { - LassoLibRegisterNameIdentifierResponse parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoRegisterNameIdentifierResponseClass { - LassoLibRegisterNameIdentifierResponseClass parent; -}; - -LASSO_EXPORT GType lasso_register_name_identifier_response_get_type (void); - -LASSO_EXPORT LassoNode* lasso_register_name_identifier_response_new (gchar *providerID, - gchar *statusCodeValue, - LassoNode *request); - -LASSO_EXPORT LassoNode* lasso_register_name_identifier_response_new_from_export (gchar *buffer, - lassoNodeExportType export_type); - -LASSO_EXPORT LassoNode* lasso_register_name_identifier_response_new_from_request_export (gchar *buffer, - lassoNodeExportType export_type, - gchar *providerID, - gchar *statusCodeValue); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_REGISTER_NAME_IDENTIFIER_RESPONSE_H__ */ diff --git a/lasso/Attic/protocols/request.c b/lasso/Attic/protocols/request.c deleted file mode 100644 index c9851718..00000000 --- a/lasso/Attic/protocols/request.c +++ /dev/null @@ -1,145 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -/*****************************************************************************/ -/* functions */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_request_instance_init(LassoRequest *request) -{ -} - -static void -lasso_request_class_init(LassoRequestClass *class) -{ -} - -GType lasso_request_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoRequestClass), - NULL, - NULL, - (GClassInitFunc) lasso_request_class_init, - NULL, - NULL, - sizeof(LassoRequest), - 0, - (GInstanceInitFunc) lasso_request_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_SAMLP_REQUEST, - "LassoRequest", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_request_new(const xmlChar *assertionArtifact) -{ - LassoNode *request; - xmlChar *id, *time; - - request = LASSO_NODE(g_object_new(LASSO_TYPE_REQUEST, NULL)); - - /* Set ONLY required elements/attributes */ - /* RequestID */ - id = lasso_build_unique_id(32); - lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request), - id); - xmlFree(id); - /* MajorVersion */ - lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoSamlMajorVersion); - /* MinorVersion */ - lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoSamlMinorVersion); - /* IssueInstant */ - time = lasso_get_current_time(); - lasso_samlp_request_abstract_set_issueInstant(LASSO_SAMLP_REQUEST_ABSTRACT(request), - time); - xmlFree(time); - - /* Signature template with X509 - FIXME: signature method */ - lasso_samlp_request_abstract_set_signature_tmpl(LASSO_SAMLP_REQUEST_ABSTRACT(request), - lassoSignatureTypeWithX509, - lassoSignatureMethodRsaSha1, - NULL); - - /* AssertionArtifact */ - lasso_samlp_request_set_assertionArtifact(LASSO_SAMLP_REQUEST(request), - assertionArtifact); - - return request; -} - -LassoNode* -lasso_request_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *request=NULL, *soap_node, *request_node; - gchar *export; - - g_return_val_if_fail(buffer != NULL, NULL); - - request = LASSO_NODE(g_object_new(LASSO_TYPE_REQUEST, NULL)); - - switch (export_type) { - case lassoNodeExportTypeXml: - lasso_node_import(request, buffer); - break; - case lassoNodeExportTypeQuery: - case lassoNodeExportTypeBase64: - break; - case lassoNodeExportTypeSoap: - soap_node = lasso_node_new_from_dump(buffer); - request_node = lasso_node_get_child(soap_node, "Request", - lassoSamlProtocolHRef, NULL); - export = lasso_node_export(request_node); - lasso_node_import(request, export); - g_free(export); - lasso_node_destroy(request_node); - lasso_node_destroy(soap_node); - break; - } - - return request; -} diff --git a/lasso/Attic/protocols/request.h b/lasso/Attic/protocols/request.h deleted file mode 100644 index a002e124..00000000 --- a/lasso/Attic/protocols/request.h +++ /dev/null @@ -1,66 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_REQUEST_H__ -#define __LASSO_REQUEST_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include - -#define LASSO_TYPE_REQUEST (lasso_request_get_type()) -#define LASSO_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_REQUEST, LassoRequest)) -#define LASSO_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_REQUEST, LassoRequestClass)) -#define LASSO_IS_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_REQUEST)) -#define LASSO_IS_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_REQUEST)) -#define LASSO_REQUEST_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_REQUEST, LassoRequestClass)) - -typedef struct _LassoRequest LassoRequest; -typedef struct _LassoRequestClass LassoRequestClass; - -struct _LassoRequest { - LassoSamlpRequest parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoRequestClass { - LassoSamlpRequestClass parent; -}; - -LASSO_EXPORT GType lasso_request_get_type (void); - -LASSO_EXPORT LassoNode* lasso_request_new (const xmlChar *assertionArtifact); - -LASSO_EXPORT LassoNode* lasso_request_new_from_export (gchar *buffer, - lassoNodeExportType export_type); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_REQUEST_H__ */ diff --git a/lasso/Attic/protocols/response.c b/lasso/Attic/protocols/response.c deleted file mode 100644 index ee044f28..00000000 --- a/lasso/Attic/protocols/response.c +++ /dev/null @@ -1,143 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Valery Febvre - * Nicolas Clapies - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -/*****************************************************************************/ -/* functions */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* public methods */ -/*****************************************************************************/ - -/*****************************************************************************/ -/* instance and class init functions */ -/*****************************************************************************/ - -static void -lasso_response_instance_init(LassoResponse *response) -{ -} - -static void -lasso_response_class_init(LassoResponseClass *class) -{ -} - -GType lasso_response_get_type() { - static GType this_type = 0; - - if (!this_type) { - static const GTypeInfo this_info = { - sizeof (LassoResponseClass), - NULL, - NULL, - (GClassInitFunc) lasso_response_class_init, - NULL, - NULL, - sizeof(LassoResponse), - 0, - (GInstanceInitFunc) lasso_response_instance_init, - }; - - this_type = g_type_register_static(LASSO_TYPE_SAMLP_RESPONSE, - "LassoResponse", - &this_info, 0); - } - return this_type; -} - -LassoNode* -lasso_response_new() -{ - LassoNode *response; - xmlChar *id, *time; - LassoNode *status, *status_code; - - response = lasso_samlp_response_new(); - - /* Set ONLY required elements/attributes */ - /* ResponseID */ - id = lasso_build_unique_id(32); - lasso_samlp_response_abstract_set_responseID(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - id); - xmlFree(id); - /* MajorVersion */ - lasso_samlp_response_abstract_set_majorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - lassoSamlMajorVersion); - /* MinorVersion */ - lasso_samlp_response_abstract_set_minorVersion(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - lassoSamlMinorVersion); - /* IssueInstant */ - time = lasso_get_current_time(); - lasso_samlp_response_abstract_set_issueInstant(LASSO_SAMLP_RESPONSE_ABSTRACT(response), - time); - xmlFree(time); - - /* Add Status */ - status = lasso_samlp_status_new(); - status_code = lasso_samlp_status_code_new(); - lasso_samlp_status_code_set_value(LASSO_SAMLP_STATUS_CODE(status_code), lassoSamlStatusCodeSuccess); - lasso_samlp_status_set_statusCode(LASSO_SAMLP_STATUS(status), LASSO_SAMLP_STATUS_CODE(status_code)); - lasso_samlp_response_set_status(LASSO_SAMLP_RESPONSE(response), LASSO_SAMLP_STATUS(status)); - lasso_node_destroy(status_code); - lasso_node_destroy(status); - - return response; -} - -LassoNode* -lasso_response_new_from_export(gchar *buffer, - lassoNodeExportType export_type) -{ - LassoNode *response = NULL, *soap_node, *response_node; - gchar *export; - - g_return_val_if_fail(buffer != NULL, NULL); - - response = LASSO_NODE(g_object_new(LASSO_TYPE_RESPONSE, NULL)); - - switch (export_type) { - case lassoNodeExportTypeXml: - lasso_node_import(response, buffer); - break; - case lassoNodeExportTypeBase64: - case lassoNodeExportTypeQuery: - break; - case lassoNodeExportTypeSoap: - soap_node = lasso_node_new_from_dump(buffer); - response_node = lasso_node_get_child(soap_node, "Response", - lassoSamlProtocolHRef, NULL); - export = lasso_node_export(response_node); - lasso_node_import(response, export); - g_free(export); - lasso_node_destroy(response_node); - lasso_node_destroy(soap_node); - break; - } - - return response; -} diff --git a/lasso/Attic/protocols/response.h b/lasso/Attic/protocols/response.h deleted file mode 100644 index 886e66f0..00000000 --- a/lasso/Attic/protocols/response.h +++ /dev/null @@ -1,66 +0,0 @@ -/* $Id$ - * - * Lasso - A free implementation of the Liberty Alliance specifications. - * - * Copyright (C) 2004 Entr'ouvert - * http://lasso.entrouvert.org - * - * Authors: Nicolas Clapies - * Valery Febvre - * - * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LASSO_RESPONSE_H__ -#define __LASSO_RESPONSE_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include - -#define LASSO_TYPE_RESPONSE (lasso_response_get_type()) -#define LASSO_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_RESPONSE, LassoResponse)) -#define LASSO_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_RESPONSE, LassoResponseClass)) -#define LASSO_IS_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_RESPONSE)) -#define LASSO_IS_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_RESPONSE)) -#define LASSO_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_RESPONSE, LassoResponseClass)) - -typedef struct _LassoResponse LassoResponse; -typedef struct _LassoResponseClass LassoResponseClass; - -struct _LassoResponse { - LassoSamlpResponse parent; - /*< public >*/ - /*< private >*/ -}; - -struct _LassoResponseClass { - LassoSamlpResponseClass parent; -}; - -LASSO_EXPORT GType lasso_response_get_type (void); - -LASSO_EXPORT LassoNode* lasso_response_new (void); - -LASSO_EXPORT LassoNode* lasso_response_new_from_export (gchar *buffer, - lassoNodeExportType export_type); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LASSO_RESPONSE_H__ */