summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lasso/Attic/protocols/protocol.c141
-rw-r--r--lasso/Attic/protocols/protocol.h76
-rw-r--r--lasso/Attic/protocols/ssoaf_authn_request.c251
-rw-r--r--lasso/Attic/protocols/ssoaf_authn_request.h90
4 files changed, 558 insertions, 0 deletions
diff --git a/lasso/Attic/protocols/protocol.c b/lasso/Attic/protocols/protocol.c
new file mode 100644
index 00000000..3bc2d280
--- /dev/null
+++ b/lasso/Attic/protocols/protocol.c
@@ -0,0 +1,141 @@
+/* $Id$
+ *
+ * Lasso - A free implementation of the Liberty Alliance specifications.
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: Valery Febvre <vfebvre@easter-eggs.com>
+ * Nicolas Clapies <nclapies@entrouvert.com>
+ *
+ * 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 <lasso/protocols/protocol.h>
+
+struct _LassoProtocolPrivate
+{
+ gboolean dispose_has_run;
+ gchar *type_name;
+};
+
+/*****************************************************************************/
+/* virtual public methods */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* virtual private methods */
+/*****************************************************************************/
+
+static void
+lasso_node_set_type(LassoProtocol *protocol,
+ const xmlChar *type)
+{
+ g_return_if_fail(LASSO_IS_PROTOCOL(protocol));
+
+ LassoProtocolClass *class = LASSO_PROTOCOL_GET_CLASS(protocol);
+ class->set_type(protocol, type);
+}
+
+/*****************************************************************************/
+/* implementation methods */
+/*****************************************************************************/
+
+static void
+lasso_protocol_impl_set_type(LassoProtocol *protocol,
+ const xmlChar *type)
+{
+ g_return_if_fail (LASSO_IS_PROTOCOL(protocol));
+ g_return_if_fail (type != NULL);
+
+ protocol->private->type_name = xmlStrdup(type);
+}
+
+/*****************************************************************************/
+/* instance and class init functions */
+/*****************************************************************************/
+
+static void
+lasso_protocol_instance_init(LassoProtocol *instance)
+{
+ LassoProtocol *protocol = LASSO_PROTOCOL(instance);
+
+ protocol->private = g_new (LassoProtocolPrivate, 1);
+ protocol->private->dispose_has_run = FALSE;
+ protocol->private->type_name = NULL;
+}
+
+/* overrided parent class methods */
+
+static void
+lasso_protocol_dispose(LassoProtocol *protocol)
+{
+ if (protocol->private->dispose_has_run) {
+ return;
+ }
+ protocol->private->dispose_has_run = TRUE;
+
+ /* unref reference counted objects */
+ /* we don't have any here */
+ g_print("%s 0x%x disposed ...\n", protocol->private->type_name, protocol);
+}
+
+static void
+lasso_protocol_finalize(LassoProtocol *protocol)
+{
+ g_print("%s 0x%x finalized ...\n", protocol->private->type_name, protocol);
+ g_free (protocol->private->type_name);
+}
+
+static void
+lasso_protocol_class_init(LassoProtocolClass *class)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS(class);
+
+ /* virtual public methods */
+
+ /* virtual private methods */
+ class->set_type = lasso_protocol_impl_set_type;
+
+ /* override parent class methods */
+ gobject_class->dispose = (void *)lasso_protocol_dispose;
+ gobject_class->finalize = (void *)lasso_protocol_finalize;
+}
+
+GType lasso_protocol_get_type() {
+ static GType this_type = 0;
+
+ if (!this_type) {
+ static const GTypeInfo this_info = {
+ sizeof (LassoProtocolClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) lasso_protocol_class_init,
+ NULL,
+ NULL,
+ sizeof(LassoProtocol),
+ 0,
+ (GInstanceInitFunc) lasso_protocol_instance_init,
+ };
+
+ this_type = g_type_register_static(G_TYPE_OBJECT , "LassoProtocol",
+ &this_info, 0);
+ }
+ return this_type;
+}
+
+LassoProtocol* lasso_protocol_new() {
+ return (LASSO_PROTOCOL(g_object_new(LASSO_TYPE_PROTOCOL, NULL)));
+}
diff --git a/lasso/Attic/protocols/protocol.h b/lasso/Attic/protocols/protocol.h
new file mode 100644
index 00000000..f933af05
--- /dev/null
+++ b/lasso/Attic/protocols/protocol.h
@@ -0,0 +1,76 @@
+/* $Id$
+ *
+ * Lasso - A free implementation of the Liberty Alliance specifications.
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: Valery Febvre <vfebvre@easter-eggs.com>
+ * Nicolas Clapies <nclapies@entrouvert.com>
+ *
+ * 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_PROTOCOL_H__
+#define __LASSO_PROTOCOL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <lasso/protocols/protocols.h>
+
+#define LASSO_TYPE_PROTOCOL (lasso_protocol_get_type())
+#define LASSO_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_PROTOCOL, LassoProtocol))
+#define LASSO_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_PROTOCOL, LassoProtocolClass))
+#define LASSO_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_PROTOCOL))
+#define LASSO_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_PROTOCOL))
+#define LASSO_PROTOCOL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_PROTOCOL, LassoProtocolClass))
+
+typedef struct _LassoProtocol LassoProtocol;
+typedef struct _LassoProtocolClass LassoProtocolClass;
+typedef struct _LassoProtocolPrivate LassoProtocolPrivate;
+
+/**
+ * _LassoProtocol:
+ * @parent: the parent object
+ * @private: private pointer structure
+ **/
+struct _LassoProtocol {
+ GObject parent;
+ /*< public >*/
+ LassoNode *node;
+ /*< private >*/
+ LassoProtocolPrivate *private;
+};
+
+struct _LassoProtocolClass {
+ GObjectClass parent_class;
+ /*< vtable >*/
+ /*< public >*/
+ /*< private >*/
+ void (* set_type) (LassoProtocol *protocol,
+ const xmlChar *type);
+};
+
+LASSO_EXPORT GType lasso_protocol_get_type (void);
+
+LASSO_EXPORT LassoProtocol* lasso_protocol_new (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LASSO_PROTOCOL_H__ */
diff --git a/lasso/Attic/protocols/ssoaf_authn_request.c b/lasso/Attic/protocols/ssoaf_authn_request.c
new file mode 100644
index 00000000..c2537323
--- /dev/null
+++ b/lasso/Attic/protocols/ssoaf_authn_request.c
@@ -0,0 +1,251 @@
+/* $Id$
+ *
+ * Lasso - A free implementation of the Liberty Alliance specifications.
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: Valery Febvre <vfebvre@easter-eggs.com>
+ * Nicolas Clapies <nclapies@entrouvert.com>
+ *
+ * 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 <lasso/protocols/ssoaf_authn_request.h>
+
+/*****************************************************************************/
+/* public methods */
+/*****************************************************************************/
+
+void
+lasso_authn_request_set_assertionConsumerServiceID(LassoAuthnRequest *request,
+ const xmlChar *assertionConsumerServiceID)
+{
+ g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request));
+
+ LassoNode *node = LASSO_PROTOCOL(request)->node;
+
+ lasso_lib_authn_request_set_assertionConsumerServiceID(LASSO_LIB_AUTHN_REQUEST(node),
+ assertionConsumerServiceID);
+}
+
+void
+lasso_authn_request_set_consent(LassoAuthnRequest *request,
+ const xmlChar *consent)
+{
+ g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request));
+
+ LassoNode *node = LASSO_PROTOCOL(request)->node;
+
+ lasso_lib_authn_request_set_consent(LASSO_LIB_AUTHN_REQUEST(node),
+ consent);
+}
+
+void
+lasso_authn_request_set_forceAuthn(LassoAuthnRequest *request,
+ gint forceAuthn)
+{
+ g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request));
+
+ LassoNode *node = LASSO_PROTOCOL(request)->node;
+
+ lasso_lib_authn_request_set_forceAuthn(LASSO_LIB_AUTHN_REQUEST(node),
+ forceAuthn);
+}
+
+void
+lasso_authn_request_set_isPassive(LassoAuthnRequest *request,
+ gint isPassive)
+{
+ g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request));
+
+ LassoNode *node = LASSO_PROTOCOL(request)->node;
+
+ lasso_lib_authn_request_set_isPassive(LASSO_LIB_AUTHN_REQUEST(node),
+ isPassive);
+}
+
+void
+lasso_authn_request_set_nameIDPolicy(LassoAuthnRequest *request,
+ const xmlChar *nameIDPolicy)
+{
+ g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request));
+
+ LassoNode *node = LASSO_PROTOCOL(request)->node;
+
+ lasso_lib_authn_request_set_nameIDPolicy(LASSO_LIB_AUTHN_REQUEST(node),
+ nameIDPolicy);
+}
+
+void
+lasso_authn_request_set_protocolProfile(LassoAuthnRequest *request,
+ const xmlChar *protocolProfile)
+{
+ g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request));
+
+ LassoNode *node = LASSO_PROTOCOL(request)->node;
+
+ lasso_lib_authn_request_set_protocolProfile(LASSO_LIB_AUTHN_REQUEST(node),
+ protocolProfile);
+}
+
+void
+lasso_authn_request_set_requestAuthnContext(LassoAuthnRequest *request,
+ GPtrArray *authnContextClassRefs,
+ GPtrArray *authnContextStatementRefs,
+ const xmlChar *authnContextComparison)
+{
+ g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request));
+
+ LassoNode *node = LASSO_PROTOCOL(request)->node;
+ LassoNode *request_authn_context;
+ gint i;
+
+ /*
+ all arguments are optional
+ however, we need one to create the RequestAuthnContext element
+ */
+ if (authnContextClassRefs || authnContextStatementRefs || authnContextComparison) {
+ /* 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; i<authnContextClassRefs->len; 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; i<authnContextStatementRefs->len; 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(node),
+ LASSO_LIB_REQUEST_AUTHN_CONTEXT(request_authn_context));
+ }
+}
+
+void
+lasso_authn_request_set_relayState(LassoAuthnRequest *request,
+ const xmlChar *relayState)
+{
+ g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request));
+
+ LassoNode *node = LASSO_PROTOCOL(request)->node;
+
+ lasso_lib_authn_request_set_relayState(LASSO_LIB_AUTHN_REQUEST(node),
+ relayState);
+}
+
+void
+lasso_authn_request_set_scoping(LassoAuthnRequest *request,
+ gint proxyCount)
+{
+ g_return_if_fail (LASSO_IS_AUTHN_REQUEST(request));
+
+ LassoNode *node = LASSO_PROTOCOL(request)->node;
+ LassoNode *scoping;
+
+ /* create a new Scoping instance */
+ scoping = lasso_lib_scoping_new();
+ /* ProxyCount */
+ lasso_lib_scoping_set_proxyCount(LASSO_LIB_SCOPING(scoping), proxyCount);
+ /* FIXME : set IDPList */
+ lasso_lib_authn_request_set_scoping(LASSO_LIB_AUTHN_REQUEST(node),
+ LASSO_LIB_SCOPING(scoping));
+}
+
+/*****************************************************************************/
+/* instance and class init functions */
+/*****************************************************************************/
+
+static void
+lasso_authn_request_instance_init(LassoAuthnRequest *protocol)
+{
+ LassoProtocolClass *class = LASSO_PROTOCOL_GET_CLASS(LASSO_PROTOCOL(protocol));
+
+ class->set_type(LASSO_PROTOCOL(protocol), "AuthnRequest");
+}
+
+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_PROTOCOL,
+ "LassoAuthnRequest",
+ &this_info, 0);
+ }
+ return this_type;
+}
+
+LassoProtocol*
+lasso_authn_request_new(const xmlChar *providerID)
+{
+ LassoProtocol *request;
+
+ request = LASSO_PROTOCOL(g_object_new(LASSO_TYPE_AUTHN_REQUEST, NULL));
+
+ /*
+ create a new LibAuthnRequest instance
+ ONLY elements/attributs required
+ */
+ request->node = lasso_lib_authn_request_new();
+
+ /* RequestID */
+ lasso_samlp_request_abstract_set_requestID(LASSO_SAMLP_REQUEST_ABSTRACT(request->node),
+ (const xmlChar *)lasso_build_unique_id(32));
+ /* MajorVersion */
+ lasso_samlp_request_abstract_set_majorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request->node),
+ lassoLibMajorVersion);
+ /* MinorVersion */
+ lasso_samlp_request_abstract_set_minorVersion(LASSO_SAMLP_REQUEST_ABSTRACT(request->node),
+ lassoLibMinorVersion);
+ /* IssueInstant */
+ lasso_samlp_request_abstract_set_issueInstance(LASSO_SAMLP_REQUEST_ABSTRACT(request->node),
+ lasso_get_current_time());
+ /* ProviderID */
+ lasso_lib_authn_request_set_providerID(LASSO_LIB_AUTHN_REQUEST(request->node),
+ providerID);
+
+ return (request);
+}
diff --git a/lasso/Attic/protocols/ssoaf_authn_request.h b/lasso/Attic/protocols/ssoaf_authn_request.h
new file mode 100644
index 00000000..73a99dc7
--- /dev/null
+++ b/lasso/Attic/protocols/ssoaf_authn_request.h
@@ -0,0 +1,90 @@
+/* $Id$
+ *
+ * Lasso - A free implementation of the Liberty Alliance specifications.
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: Valery Febvre <vfebvre@easter-eggs.com>
+ * Nicolas Clapies <nclapies@entrouvert.com>
+ *
+ * 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_SSOAF_AUTHN_REQUEST_H__
+#define __LASSO_SSOAF_AUTHN_REQUEST_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <lasso/protocols/protocol.h>
+
+#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 LASSP_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 {
+ LassoProtocol parent;
+ /*< private >*/
+};
+
+struct _LassoAuthnRequestClass {
+ LassoProtocolClass parent;
+};
+
+LASSO_EXPORT GType lasso_authn_request_get_type (void);
+LASSO_EXPORT LassoProtocol* lasso_authn_request_new (const xmlChar *providerID);
+
+LASSO_EXPORT void lasso_authn_request_set_assertionConsumerServiceID (LassoAuthnRequest *request,
+ const xmlChar *assertionConsumerServiceID);
+
+LASSO_EXPORT void lasso_authn_request_set_consent (LassoAuthnRequest *request,
+ const xmlChar *consent);
+
+LASSO_EXPORT void lasso_authn_request_set_forceAuthn (LassoAuthnRequest *request,
+ gint forceAuthn);
+
+LASSO_EXPORT void lasso_authn_request_set_isPassive (LassoAuthnRequest *request,
+ gint isPassive);
+
+LASSO_EXPORT void lasso_authn_request_set_nameIDPolicy (LassoAuthnRequest *request,
+ const xmlChar *nameIDPolicy);
+
+LASSO_EXPORT void lasso_authn_request_set_protocolProfile (LassoAuthnRequest *request,
+ const xmlChar *protocolProfile);
+
+LASSO_EXPORT void lasso_authn_request_set_requestAuthnContext (LassoAuthnRequest *request,
+ GPtrArray *authnContextClassRefs,
+ GPtrArray *authnContextStatementRefs,
+ const xmlChar *authnContextComparison);
+
+LASSO_EXPORT void lasso_authn_request_set_relayState (LassoAuthnRequest *request,
+ const xmlChar *relayState);
+
+LASSO_EXPORT void lasso_authn_request_set_scoping (LassoAuthnRequest *request,
+ gint proxyCount);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LASSO_SSOAF_AUTHN_REQUEST_H__ */