From 8e7ee71d26aa0e2e773320c3a160ca00dfb8018a Mon Sep 17 00:00:00 2001 From: Nicolas Clapies Date: Thu, 22 Jul 2004 14:07:36 +0000 Subject: add level 2 of LECP --- lasso/Attic/protocols/Makefile.am | 4 + lasso/Attic/protocols/authn_request_envelope.c | 118 ++++++++++++++++++++++++ lasso/Attic/protocols/authn_request_envelope.h | 68 ++++++++++++++ lasso/Attic/protocols/authn_response_envelope.c | 115 +++++++++++++++++++++++ lasso/Attic/protocols/authn_response_envelope.h | 67 ++++++++++++++ 5 files changed, 372 insertions(+) create mode 100644 lasso/Attic/protocols/authn_request_envelope.c create mode 100644 lasso/Attic/protocols/authn_request_envelope.h create mode 100644 lasso/Attic/protocols/authn_response_envelope.c create mode 100644 lasso/Attic/protocols/authn_response_envelope.h diff --git a/lasso/Attic/protocols/Makefile.am b/lasso/Attic/protocols/Makefile.am index 4d1fbf26..a6ea250f 100644 --- a/lasso/Attic/protocols/Makefile.am +++ b/lasso/Attic/protocols/Makefile.am @@ -25,7 +25,9 @@ liblasso_protocols_la_SOURCES = \ protocols.c \ artifact.c \ authn_request.c \ + authn_request_envelope.c \ authn_response.c \ + authn_response_envelope.c \ federation_termination_notification.c \ identity.c \ logout_request.c \ @@ -42,7 +44,9 @@ liblassoinclude_HEADERS = \ protocols.h \ artifact.h \ authn_request.h \ + authn_request_envelope.h \ authn_response.h \ + authn_response_envelope.h \ federation_termination_notification.h \ identity.h \ logout_request.h \ diff --git a/lasso/Attic/protocols/authn_request_envelope.c b/lasso/Attic/protocols/authn_request_envelope.c new file mode 100644 index 00000000..f96c6315 --- /dev/null +++ b/lasso/Attic/protocols/authn_request_envelope.c @@ -0,0 +1,118 @@ +/* $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_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(LassoLibAuthnRequest *authnRequest, + const xmlChar *providerID, + const xmlChar *assertionConsumerServiceURL) +{ + LassoNode *request; + + g_return_val_if_fail(LASSO_IS_LIB_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), 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, + lassoNodeExportTypes 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 lassoNodeExportTypeBase64: + buffer_decoded = xmlMalloc(strlen(buffer)); + xmlSecBase64Decode(buffer, buffer_decoded, strlen(buffer)); + lasso_node_import(request, buffer_decoded); + xmlFree(buffer_decoded); + default: + break; + } + + return(request); +} diff --git a/lasso/Attic/protocols/authn_request_envelope.h b/lasso/Attic/protocols/authn_request_envelope.h new file mode 100644 index 00000000..06482477 --- /dev/null +++ b/lasso/Attic/protocols/authn_request_envelope.h @@ -0,0 +1,68 @@ +/* $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 + +#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 (LassoLibAuthnRequest *authnRequest, + const xmlChar *providerID, + const xmlChar *assertionConsumerServiceURL); + +LASSO_EXPORT LassoNode* lasso_authn_request_envelope_new_from_export (gchar *buffer, + lassoNodeExportTypes export_type); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_AUTHN_REQUEST_ENVELOPE_H__ */ diff --git a/lasso/Attic/protocols/authn_response_envelope.c b/lasso/Attic/protocols/authn_response_envelope.c new file mode 100644 index 00000000..2f9ccd2b --- /dev/null +++ b/lasso/Attic/protocols/authn_response_envelope.c @@ -0,0 +1,115 @@ +/* $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_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(LassoLibAuthnResponse *authnResponse, + const xmlChar *assertionConsumerServiceURL) +{ + LassoNode *response; + + g_return_val_if_fail(LASSO_IS_LIB_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), authnResponse); + lasso_lib_authn_response_envelope_set_assertionConsumerServiceURL(LASSO_LIB_AUTHN_RESPONSE_ENVELOPE(response), + assertionConsumerServiceURL); + + return(response); +} + +LassoNode* +lasso_authn_response_envelope_new_from_export(gchar *buffer, + lassoNodeExportTypes export_type) +{ + LassoNode *response; + xmlChar *buffer_decoded; + + g_return_val_if_fail(buffer != NULL, NULL); + + response = LASSO_NODE(g_object_new(LASSO_TYPE_AUTHN_RESPONSE_ENVELOPE, NULL)); + + switch(export_type){ + case lassoNodeExportTypeBase64: + buffer_decoded = xmlMalloc(strlen(buffer)); + xmlSecBase64Decode(buffer, buffer_decoded, strlen(buffer)); + lasso_node_import(response, buffer_decoded); + xmlFree(buffer_decoded); + default: + break; + } + + return(response); +} diff --git a/lasso/Attic/protocols/authn_response_envelope.h b/lasso/Attic/protocols/authn_response_envelope.h new file mode 100644 index 00000000..9e50f771 --- /dev/null +++ b/lasso/Attic/protocols/authn_response_envelope.h @@ -0,0 +1,67 @@ +/* $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 + +#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 (LassoLibAuthnResponse *authnResponse, + const xmlChar *assertionConsumerServiceURL); + +LASSO_EXPORT LassoNode* lasso_authn_response_envelope_new_from_export (gchar *buffer, + lassoNodeExportTypes export_type); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_AUTHN_RESPONSE_ENVELOPE_H__ */ -- cgit