summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValery Febvre <vfebvre at easter-eggs.com>2004-06-25 16:42:25 +0000
committerValery Febvre <vfebvre at easter-eggs.com>2004-06-25 16:42:25 +0000
commitdf4e8f993c29a17e329fff0b3723a91ee3095bd1 (patch)
tree00635bbb33fce2de9e17c4622aff51cd97f6ab30
parenteef1d1971c940056d9321a545d11aa2004508d3c (diff)
downloadlasso-df4e8f993c29a17e329fff0b3723a91ee3095bd1.tar.gz
lasso-df4e8f993c29a17e329fff0b3723a91ee3095bd1.tar.xz
lasso-df4e8f993c29a17e329fff0b3723a91ee3095bd1.zip
Initial commit
-rw-r--r--lasso/Attic/protocols/identity.c95
-rw-r--r--lasso/Attic/protocols/identity.h74
-rw-r--r--lasso/Attic/protocols/provider.c143
-rw-r--r--lasso/Attic/protocols/provider.h78
-rw-r--r--lasso/id-ff/server.c124
-rw-r--r--lasso/id-ff/server.h80
-rw-r--r--lasso/id-ff/user.c112
-rw-r--r--lasso/id-ff/user.h70
8 files changed, 776 insertions, 0 deletions
diff --git a/lasso/Attic/protocols/identity.c b/lasso/Attic/protocols/identity.c
new file mode 100644
index 00000000..ad6129ff
--- /dev/null
+++ b/lasso/Attic/protocols/identity.c
@@ -0,0 +1,95 @@
+/* $Id$
+ *
+ * Lasso - A free implementation of the Liberty Alliance specifications.
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Author: Valery Febvre <vfebvre@easter-eggs.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/identity.h>
+
+/*****************************************************************************/
+/* public methods */
+/*****************************************************************************/
+
+gint
+lasso_identity_set_local_name_identifier(LassoIdentity *identity,
+ LassoNode *nameIdentifier)
+{
+ identity->local_nameIdentifier = nameIdentifier;
+}
+
+gint
+lasso_identity_set_remote_nameIdentifier(LassoIdentity *identity,
+ LassoNode *nameIdentifier)
+{
+ identity->remote_nameIdentifier = nameIdentifier;
+}
+
+/*****************************************************************************/
+/* instance and class init functions */
+/*****************************************************************************/
+
+static void
+lasso_identity_instance_init(LassoIdentity *identity)
+{
+ identity->local_nameIdentifier = NULL;
+ identity->remote_nameIdentifier = NULL;
+}
+
+static void
+lasso_identity_class_init(LassoIdentityClass *klass)
+{
+}
+
+GType lasso_identity_get_type() {
+ static GType this_type = 0;
+
+ if (!this_type) {
+ static const GTypeInfo this_info = {
+ sizeof (LassoIdentityClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) lasso_identity_class_init,
+ NULL,
+ NULL,
+ sizeof(LassoIdentity),
+ 0,
+ (GInstanceInitFunc) lasso_identity_instance_init,
+ };
+
+ this_type = g_type_register_static(LASSO_TYPE_NODE,
+ "LassoIdentity",
+ &this_info, 0);
+ }
+ return this_type;
+}
+
+LassoIdentity*
+lasso_identity_new(gchar *remote_providerID)
+{
+ LassoIdentity *identity;
+
+ identity = g_object_new(LASSO_TYPE_IDENTITY, NULL);
+
+ identity->remote_providerID = (char *)malloc(strlen(remote_providerID)+1);
+ sprintf(identity->remote_providerID, "%s", remote_providerID);
+
+ return(identity);
+}
diff --git a/lasso/Attic/protocols/identity.h b/lasso/Attic/protocols/identity.h
new file mode 100644
index 00000000..53bd39ee
--- /dev/null
+++ b/lasso/Attic/protocols/identity.h
@@ -0,0 +1,74 @@
+/* $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_IDENTITY_H__
+#define __LASSO_IDENTITY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <lasso/xml/xml.h>
+
+#define LASSO_TYPE_IDENTITY (lasso_identity_get_type())
+#define LASSO_IDENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_IDENTITY, LassoIdentity))
+#define LASSO_IDENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_IDENTITY, LassoIdentityClass))
+#define LASSO_IS_IDENTITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_IDENTITY))
+#define LASSP_IS_IDENTITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_IDENTITY))
+#define LASSO_IDENTITY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_IDENTITY, LassoIdentityClass))
+
+typedef struct _LassoIdentity LassoIdentity;
+typedef struct _LassoIdentityClass LassoIdentityClass;
+
+struct _LassoIdentity {
+ LassoNode parent;
+
+ gchar *remote_providerID;
+
+ LassoNode *local_nameIdentifier;
+ LassoNode *remote_nameIdentifier;
+
+ /*< private >*/
+};
+
+struct _LassoIdentityClass {
+ LassoNodeClass parent;
+};
+
+LASSO_EXPORT GType lasso_identity_get_type(void);
+
+LASSO_EXPORT LassoIdentity* lasso_identity_new (gchar *remote_providerID);
+
+LASSO_EXPORT gint lasso_identity_set_local_name_identifier (LassoIdentity *identity,
+ LassoNode *nameIdentifier);
+
+LASSO_EXPORT gint lasso_identity_set_remote_nameIdentifier (LassoIdentity *identity,
+ LassoNode *nameIdentifier);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LASSO_IDENTITY_H__ */
diff --git a/lasso/Attic/protocols/provider.c b/lasso/Attic/protocols/provider.c
new file mode 100644
index 00000000..3ef19f27
--- /dev/null
+++ b/lasso/Attic/protocols/provider.c
@@ -0,0 +1,143 @@
+/* $Id$
+ *
+ * Lasso - A free implementation of the Liberty Alliance specifications.
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Author: Valery Febvre <vfebvre@easter-eggs.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/provider.h>
+
+/*****************************************************************************/
+/* public methods */
+/*****************************************************************************/
+xmlChar *
+lasso_provider_get_providerID(LassoProvider *provider)
+{
+ return(lasso_node_get_attr_value(provider->metadata, "ProviderID"));
+}
+
+xmlChar *
+lasso_provider_get_singleSignOnProtocolProfile(LassoProvider *provider)
+{
+ return(lasso_node_get_child_content(provider->metadata, "SingleSignOnProtocolProfile", NULL));
+}
+
+xmlChar *
+lasso_provider_get_singleSignOnServiceUrl(LassoProvider *provider)
+{
+ return(lasso_node_get_child_content(provider->metadata, "SingleSignOnServiceUrl", NULL));
+}
+
+xmlChar *lasso_provider_get_singleLogoutProtocolProfile(LassoProvider *provider)
+{
+ return(lasso_node_get_child_content(provider->metadata, "SingleLogoutProtocolProfile", NULL));
+}
+
+xmlChar *lasso_provider_get_singleLogoutServiceUrl(LassoProvider *provider)
+{
+ return(lasso_node_get_child_content(provider->metadata, "SingleLogoutServiceUrl", NULL));
+}
+
+xmlChar *lasso_provider_get_singleLogoutServiceReturnUrl(LassoProvider *provider)
+{
+ return(lasso_node_get_child_content(provider->metadata, "SingleLogoutServiceReturnUrl", NULL));
+}
+
+/*****************************************************************************/
+/* private methods */
+/*****************************************************************************/
+
+static xmlChar *lasso_provider_get_direct_child_content(LassoProvider *provider,
+ const xmlChar *name)
+{
+ LassoNode *node;
+
+ node = lasso_node_get_child(LASSO_NODE(provider), name, NULL);
+ if(!node)
+ return(NULL);
+ return(lasso_node_get_content(node));
+}
+
+
+/*****************************************************************************/
+/* instance and class init functions */
+/*****************************************************************************/
+
+static void
+lasso_provider_instance_init(LassoProvider *provider)
+{
+ LassoNodeClass *class = LASSO_NODE_GET_CLASS(LASSO_NODE(provider));
+
+ class->set_name(LASSO_NODE(provider), "Provider");
+}
+
+static void
+lasso_provider_class_init(LassoProviderClass *klass) {
+}
+
+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(LASSO_TYPE_NODE,
+ "LassoProvider",
+ &this_info, 0);
+ }
+ return this_type;
+}
+
+LassoNode* lasso_provider_new(){
+ LassoNode *provider;
+
+ provider = LASSO_NODE(g_object_new(LASSO_TYPE_PROVIDER, NULL));
+
+ return (provider);
+}
+
+LassoProvider *lasso_provider_new_from_filename(char *filename){
+ LassoProvider *provider;
+ xmlDocPtr doc;
+ xmlNodePtr root;
+
+ provider = g_object_new(LASSO_TYPE_PROVIDER, NULL);
+
+ /* get root element of doc and duplicate it */
+ doc = xmlParseFile(filename);
+ root = xmlCopyNode(xmlDocGetRootElement(doc), 1);
+ xmlFreeDoc(doc);
+ provider->metadata = lasso_node_new_from_xmlNode(root);
+
+ provider->public_key = NULL;
+ provider->certificate = NULL;
+
+ return(provider);
+}
diff --git a/lasso/Attic/protocols/provider.h b/lasso/Attic/protocols/provider.h
new file mode 100644
index 00000000..6a5bbd1d
--- /dev/null
+++ b/lasso/Attic/protocols/provider.h
@@ -0,0 +1,78 @@
+/* $Id$
+ *
+ * Lasso - A free implementation of the Liberty Alliance specifications.
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Author: Valery Febvre <vfebvre@easter-eggs.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_PROVIDER_H__
+#define __LASSO_PROVIDER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <lasso/xml/xml.h>
+
+#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 LASSP_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))
+
+typedef struct _LassoProvider LassoProvider;
+typedef struct _LassoProviderClass LassoProviderClass;
+
+struct _LassoProvider {
+ LassoNode parent;
+
+ LassoNode *metadata;
+
+ char *public_key;
+ char *certificate;
+
+ /*< private >*/
+};
+
+struct _LassoProviderClass {
+ LassoNodeClass parent;
+};
+
+LASSO_EXPORT GType lasso_provider_get_type (void);
+LASSO_EXPORT LassoNode* lasso_provider_new (void);
+
+LASSO_EXPORT LassoProvider *lasso_provider_new_from_filename (char *filename);
+
+LASSO_EXPORT xmlChar *lasso_provider_get_providerID (LassoProvider *provider);
+
+LASSO_EXPORT xmlChar *lasso_provider_get_singleSignOnProtocolProfile (LassoProvider *provider);
+LASSO_EXPORT xmlChar *lasso_provider_get_singleSignOnServiceUrl (LassoProvider *provider);
+
+LASSO_EXPORT xmlChar *lasso_provider_get_singleLogoutProtocolProfile (LassoProvider *provider);
+LASSO_EXPORT xmlChar *lasso_provider_get_singleLogoutServiceUrl (LassoProvider *provider);
+LASSO_EXPORT xmlChar *lasso_provider_get_singleLogoutServiceReturnUrl (LassoProvider *provider);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LASSO_PROVIDER_H__ */
diff --git a/lasso/id-ff/server.c b/lasso/id-ff/server.c
new file mode 100644
index 00000000..8da4472c
--- /dev/null
+++ b/lasso/id-ff/server.c
@@ -0,0 +1,124 @@
+/* $Id$
+ *
+ * Lasso - A free implementation of the Liberty Alliance specifications.
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Author: Valery Febvre <vfebvre@easter-eggs.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/environs/server.h>
+
+/*****************************************************************************/
+/* public methods */
+/*****************************************************************************/
+
+gint
+lasso_server_add_provider_from_file(LassoServer *server,
+ gchar *filename)
+{
+ LassoProvider *provider;
+
+ provider = lasso_provider_new_from_filename(filename);
+ g_ptr_array_add(server->providers, provider);
+
+ return (1);
+}
+
+LassoProvider*
+lasso_server_get_provider(LassoServer *server,
+ gchar *providerID)
+{
+ LassoProvider *provider;
+ char *id;
+ int index, len;
+
+ len = server->providers->len;
+ for(index = 0; index<len; index++) {
+ provider = g_ptr_array_index(server->providers, index);
+
+ id = lasso_provider_get_providerID(provider);
+ if (!strcmp(providerID, id)) {
+ return(provider);
+ }
+ }
+
+ return(NULL);
+}
+
+gint
+lasso_server_set_security(gchar *private_key,
+ gchar *public_key,
+ gchar *certificate)
+{
+ g_return_if_fail(private_key);
+ g_return_if_fail(public_key);
+ g_return_if_fail(certificate);
+
+}
+
+/*****************************************************************************/
+/* instance and class init functions */
+/*****************************************************************************/
+
+static void
+lasso_server_instance_init(LassoServer *server)
+{
+ server->providers = g_ptr_array_new();
+
+ server->private_key = NULL;
+ server->public_key = NULL;
+ server->certificate = NULL;
+}
+
+static void
+lasso_server_class_init(LassoServerClass *klass){
+}
+
+GType lasso_server_get_type() {
+ static GType this_type = 0;
+
+ if (!this_type) {
+ static const GTypeInfo this_info = {
+ sizeof (LassoServerClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) lasso_server_class_init,
+ NULL,
+ NULL,
+ sizeof(LassoServer),
+ 0,
+ (GInstanceInitFunc) lasso_server_instance_init,
+ };
+
+ this_type = g_type_register_static(G_TYPE_OBJECT,
+ "LassoServer",
+ &this_info, 0);
+ }
+ return this_type;
+}
+
+LassoServer *lasso_server_new()
+{
+ LassoServer *server;
+
+ server = g_object_new(LASSO_TYPE_SERVER, NULL);
+
+ return(server);
+
+}
diff --git a/lasso/id-ff/server.h b/lasso/id-ff/server.h
new file mode 100644
index 00000000..8c1d5274
--- /dev/null
+++ b/lasso/id-ff/server.h
@@ -0,0 +1,80 @@
+/* $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_SERVER_H__
+#define __LASSO_SERVER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <lasso/xml/xml.h>
+#include <lasso/protocols/provider.h>
+
+#define LASSO_TYPE_SERVER (lasso_server_get_type())
+#define LASSO_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SERVER, LassoServer))
+#define LASSO_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SERVER, LassoServerClass))
+#define LASSO_IS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SERVER))
+#define LASSP_IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SERVER))
+#define LASSO_SERVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SERVER, LassoServerClass))
+
+typedef struct _LassoServer LassoServer;
+typedef struct _LassoServerClass LassoServerClass;
+
+struct _LassoServer {
+ GObject parent;
+
+ GPtrArray *providers;
+
+ char *private_key;
+ char *public_key;
+ char *certificate;
+
+ /*< private >*/
+};
+
+struct _LassoServerClass {
+ GObjectClass parent;
+};
+
+LASSO_EXPORT GType lasso_server_get_type (void);
+LASSO_EXPORT LassoServer* lasso_server_new (void);
+
+LASSO_EXPORT gint lasso_server_add_provider_from_file (LassoServer *server,
+ gchar *filename);
+
+LASSO_EXPORT LassoProvider* lasso_server_get_provider (LassoServer *server,
+ gchar *providerID);
+
+LASSO_EXPORT gint lasso_server_set_security (gchar *private_key,
+ gchar *public_key,
+ gchar *certificate);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LASSO_SERVER_H__ */
diff --git a/lasso/id-ff/user.c b/lasso/id-ff/user.c
new file mode 100644
index 00000000..83d49a0f
--- /dev/null
+++ b/lasso/id-ff/user.c
@@ -0,0 +1,112 @@
+/* $Id$
+ *
+ * Lasso - A free implementation of the Liberty Alliance specifications.
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Author: Valery Febvre <vfebvre@easter-eggs.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/environs/user.h>
+
+/*****************************************************************************/
+/* public methods */
+/*****************************************************************************/
+
+LassoIdentity*
+lasso_user_find_identity(LassoUser *user,
+ gchar *remote_providerID)
+{
+ LassoIdentity *identity;
+ int index;
+
+ printf("nb identity %d\n", user->identities->len);
+ for(index = 0; index<user->identities->len; index++){
+ identity = g_ptr_array_index(user->identities, index);
+ printf("provider id : %s\n", identity->remote_providerID);
+ if(!strcmp(identity->remote_providerID, remote_providerID)){
+ return(identity);
+ }
+ }
+
+ return(NULL);
+}
+
+gint
+lasso_user_add_assertion()
+{
+
+}
+
+gint
+lasso_user_add_identity(LassoUser *user,
+ LassoIdentity *identity)
+{
+ g_ptr_array_add(user->identities, identity);
+
+ return(1);
+}
+
+/*****************************************************************************/
+/* instance and class init functions */
+/*****************************************************************************/
+
+static void
+lasso_user_instance_init(LassoUser *user)
+{
+ user->identities = g_ptr_array_new();
+ user->assertions = g_ptr_array_new();
+}
+
+static void
+lasso_user_class_init(LassoUserClass *klass)
+{
+}
+
+GType lasso_user_get_type() {
+ static GType this_type = 0;
+
+ if (!this_type) {
+ static const GTypeInfo this_info = {
+ sizeof (LassoUserClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) lasso_user_class_init,
+ NULL,
+ NULL,
+ sizeof(LassoUser),
+ 0,
+ (GInstanceInitFunc) lasso_user_instance_init,
+ };
+
+ this_type = g_type_register_static(G_TYPE_OBJECT,
+ "LassoUser",
+ &this_info, 0);
+ }
+ return this_type;
+}
+
+LassoUser*
+lasso_user_new()
+{
+ LassoUser *user;
+
+ user = LASSO_USER(g_object_new(LASSO_TYPE_USER, NULL));
+
+ return(user);
+}
diff --git a/lasso/id-ff/user.h b/lasso/id-ff/user.h
new file mode 100644
index 00000000..a7670526
--- /dev/null
+++ b/lasso/id-ff/user.h
@@ -0,0 +1,70 @@
+/* $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_USER_H__
+#define __LASSO_USER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <lasso/xml/xml.h>
+#include <lasso/protocols/identity.h>
+
+#define LASSO_TYPE_USER (lasso_user_get_type())
+#define LASSO_USER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_USER, LassoUser))
+#define LASSO_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_USER, LassoUserClass))
+#define LASSO_IS_USER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_USER))
+#define LASSP_IS_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_USER))
+#define LASSO_USER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_USER, LassoUserClass))
+
+typedef struct _LassoUser LassoUser;
+typedef struct _LassoUserClass LassoUserClass;
+
+struct _LassoUser {
+ GObject parent;
+
+ /*< public >*/
+ GPtrArray *assertions;
+ GPtrArray *identities;
+
+ /*< private >*/
+};
+
+struct _LassoUserClass {
+ GObjectClass parent;
+};
+
+LASSO_EXPORT GType lasso_user_get_type (void);
+LASSO_EXPORT LassoUser* lasso_user_new (void);
+
+LASSO_EXPORT LassoIdentity* lasso_user_find_identity (LassoUser *user,
+ gchar *remote_providerID);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LASSO_USER_H__ */