summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValery Febvre <vfebvre at easter-eggs.com>2004-06-24 16:01:48 +0000
committerValery Febvre <vfebvre at easter-eggs.com>2004-06-24 16:01:48 +0000
commit58e9b33ace84e74582198ea040db6b6d63681402 (patch)
tree261a9dc71b64db96aebc32a732380884676d8335
parent73ff0f02cab8623ab67bc8626ed7e77df1acd457 (diff)
downloadlasso-58e9b33ace84e74582198ea040db6b6d63681402.tar.gz
lasso-58e9b33ace84e74582198ea040db6b6d63681402.tar.xz
lasso-58e9b33ace84e74582198ea040db6b6d63681402.zip
Initial commit
-rw-r--r--lasso/id-ff/authentication.c336
-rw-r--r--lasso/id-ff/authentication.h92
-rw-r--r--lasso/id-ff/profile_context.c211
-rw-r--r--lasso/id-ff/profile_context.h95
4 files changed, 734 insertions, 0 deletions
diff --git a/lasso/id-ff/authentication.c b/lasso/id-ff/authentication.c
new file mode 100644
index 00000000..581f9aa6
--- /dev/null
+++ b/lasso/id-ff/authentication.c
@@ -0,0 +1,336 @@
+/* $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/xml/samlp_response.h>
+#include <lasso/protocols/request.h>
+#include <lasso/protocols/response.h>
+#include <lasso/protocols/authn_response.h>
+#include <lasso/environs/context.h>
+
+/*****************************************************************************/
+/* functions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* public methods */
+/*****************************************************************************/
+
+gchar *
+lasso_authentication_build_request(LassoAuthentication *authn,
+ const gchar *protocolProfile,
+ gboolean isPassive,
+ gboolean forceAuthn,
+ const gchar *nameIDPolicy)
+{
+ LassoProvider *provider;
+ xmlChar *request_protocolProfile, *url, *query;
+ gchar *str;
+
+ provider = lasso_server_get_provider(authn->server,
+ authn->local_providerID);
+ if (provider == NULL) {
+ return (NULL);
+ }
+
+ /* build the request object */
+ authn->request = LASSO_NODE(lasso_authn_request_new(authn->local_providerID));
+ /* optional values */
+ if (protocolProfile != NULL) {
+ lasso_lib_authn_request_set_protocolProfile(LASSO_LIB_AUTHN_REQUEST(authn->request),
+ protocolProfile);
+ }
+ if (nameIDPolicy != NULL) {
+ lasso_lib_authn_request_set_nameIDPolicy(LASSO_LIB_AUTHN_REQUEST(authn->request),
+ nameIDPolicy);
+ }
+ lasso_lib_authn_request_set_isPassive(LASSO_LIB_AUTHN_REQUEST(authn->request), isPassive);
+ lasso_lib_authn_request_set_forceAuthn(LASSO_LIB_AUTHN_REQUEST(authn->request), forceAuthn);
+
+ /* export request depending on the request protocol profile */
+ request_protocolProfile = lasso_provider_get_singleSignOnProtocolProfile(provider);
+ if (xmlStrEqual(request_protocolProfile, lassoLibProtocolProfileSSOGet)) {
+ url = lasso_provider_get_singleSignOnServiceUrl(provider);
+ query = lasso_node_export_to_query(authn->request, 1, NULL);
+ str = (gchar *) malloc(strlen(url) + strlen(query) + 2); // +2 for the ? character and the end line character
+ sprintf(str, "%s?%s", url, query);
+
+ authn->request_protocol_method = lassoProfileContextMethodGet;
+ }
+ else if (xmlStrEqual(request_protocolProfile, lassoLibProtocolProfileSSOPost)) {
+ printf("TODO - export the AuthnRequest in a formular\n");
+ }
+
+ return (str);
+}
+
+xmlChar*
+lasso_authentication_process_artifact(LassoAuthentication *authn,
+ gchar *artifact)
+{
+ authn->request = lasso_request_new(artifact);
+ return (lasso_node_export_to_soap(authn->request));
+}
+
+gboolean
+lasso_authentication_process_response(LassoAuthentication *authn,
+ xmlChar *response)
+{
+ LassoNode *statusCode, *assertion;
+ LassoNode *nameIdentifier, *idpProvidedNameIdentifier;
+ char *artifact, *statusCodeValue;
+
+ printf("DEBUG - POST response, process the authnResponse\n");
+ authn->response = LASSO_NODE(lasso_authn_response_new_from_export(response, 0));
+
+ /* process the status code value */
+ statusCode = lasso_node_get_child(authn->response, "StatusCode", NULL);
+ statusCodeValue = lasso_node_get_attr_value(statusCode, "Value");
+ if(strcmp(statusCodeValue, lassoSamlStatusCodeSuccess))
+ return(FALSE);
+
+ /* process the assertion */
+ assertion = lasso_node_get_child(authn->response, "Assertion", NULL);
+ if(!assertion)
+ return(FALSE);
+
+ /* set the name identifiers */
+ nameIdentifier = lasso_node_get_child(assertion, "NameIdentifier", NULL);
+ printf("name identifier %s(%s)\n", lasso_node_get_content(nameIdentifier), lasso_node_export(nameIdentifier));
+
+ idpProvidedNameIdentifier = lasso_node_get_child(assertion, "IDPProvidedNameIdentifier", NULL);
+
+ return(TRUE);
+}
+
+gboolean
+lasso_authentication_process_request(LassoAuthentication *authn,
+ gchar *request,
+ gint request_method,
+ gboolean is_authenticated)
+{
+ LassoProvider *provider;
+ xmlChar *protocolProfile;
+ gboolean must_authenticate = TRUE;
+ gboolean isPassive = TRUE;
+ gboolean forceAuthn = FALSE;
+ gboolean signature_status;
+
+ switch (request_method) {
+ case lasso_protocol_method_get:
+ authn->request = LASSO_NODE(lasso_authn_request_new_from_query(request));
+ authn->peer_providerID = lasso_node_get_child_content(authn->request, "ProviderID", NULL);
+
+ protocolProfile = lasso_node_get_child_content(->request, "ProtocolProfile", NULL);
+ if (xmlStrEqual(protocolProfile, lassoLibProtocolProfilePost)) {
+ authn->response = lasso_authn_response_new(->local_providerID, ->request);
+ }
+ else {
+ authn->response = lasso_response_new();
+ }
+
+ provider = lasso_server_authentication_get_provider(authn->server, authn->peer_providerID);
+ if (xmlStrEqual(lasso_node_get_child_content(provider->metadata, "AuthnRequestsSigned", NULL), "true")) {
+ signature_status = lasso_query_verify_signature(request,
+ provider->public_key,
+ authn->server->private_key);
+ /* Status & StatusCode */
+ if (signature_status == 0 || signature_status == 2) {
+ switch (signature_status) {
+ case 0:
+ set_response_status(authn->response, lassoLibStatusCodeInvalidSignature);
+ break;
+ case 2:
+ set_response_status(authn->response, lassoLibStatusCodeUnsignedAuthnRequest);
+ break;
+ }
+ }
+ }
+ break;
+ case lasso_protocol_method_post:
+ printf("TODO - lasso_authentication_process_authnRequest() - implement the parsing of the post request\n");
+ break;
+ default:
+ printf("ERROR - lasso_authentication_process_authnRequest() - Unknown protocol method\n");
+ }
+
+ /* verify if the user must be authenticated or not */
+ if (xmlStrEqual(lasso_node_get_child_content(authn->request, "IsPassive", NULL), "false")) {
+ isPassive = FALSE;
+ }
+
+ if (xmlStrEqual(lasso_node_get_child_content(authn->request, "ForceAuthn", NULL), "true")) {
+ forceAuthn = TRUE;
+ }
+
+ /* complex test to authentication process */
+ if ((forceAuthn == TRUE || is_authenticated == FALSE) && isPassive == FALSE) {
+ must_authenticate = TRUE;
+ }
+ else if (is_authenticated == FALSE && isPassive == TRUE) {
+ set_response_status(authn->response, lassoLibStatusCodeNoPassive);
+ must_authenticate = FALSE;
+ }
+
+ return (must_authenticate);
+}
+
+gchar *
+lasso_authentication_process_authentication_result(LassoAuthentication *authn,
+ gint authentication_result,
+ const gchar *authentication_method)
+{
+ LassoUser *user;
+ xmlChar *str, *nameIDPolicy, *protocolProfile;
+ LassoNode *assertion, *authentication_statement, *idpProvidedNameIdentifier;
+
+ LassoIdentity *identity;
+
+ /* process the federation policy */
+ /* TODO : implement a get identity */
+
+ printf("process authentication\n");
+ /* verify if a user context exists */
+ if (authn->user == NULL) {
+ authn->user = lasso_user_authentication_new();
+ }
+
+ identity = lasso_user_find_identity(authn->user, authn->peer_providerID);
+ nameIDPolicy = lasso_node_get_child_content(authn->request, "NameIDPolicy", NULL);
+ printf("NameIDPolicy %s\n", nameIDPolicy);
+ if (xmlStrEqual(nameIDPolicy, lassoLibNameIDPolicyTypeNone)) {
+ if (identity == NULL) {
+ set_response_status(authn->response, lassoLibStatusCodeFederationDoesNotExist);
+ }
+ }
+ else if (!strcmp(nameIDPolicy, lassoLibNameIDPolicyTypeFederated)) {
+ printf("DEBUG - NameIDPolicy is federated\n");
+ if (identity == NULL) {
+ identity = lasso_identity_new(authn->peer_providerID);
+ idpProvidedNameIdentifier = LASSO_NODE(lasso_lib_idp_provided_name_identifier_new(lasso_build_unique_id(32)));
+ lasso_identity_set_local_name_identifier(identity, idpProvidedNameIdentifier);
+ }
+ }
+ else if (xmlStrEqual(nameIDPolicy, lassoLibNameIDPolicyTypeOneTime)) {
+
+ }
+
+ /* fill the response with the assertion */
+ if (identity) {
+ printf("DEBUG - an identity found, so build an assertion\n");
+ //assertion = lasso_assertion_new(authn->local_providerID, lasso_node_get_attr_value(LASSO_NODE(authn->request),
+ // "RequestID"));
+ //authentication_statement = lasso_authentication_statement_new(authentication_method,
+ // "TODO",
+ // nameIdentifier,
+ // "TODO",
+ // "TODO",
+ // idpProvidedNameIdentifier,
+ // "TODO",
+ // "TODO");
+ //lasso_saml_assertion_add_authenticationStatement(assertion,
+ // authentication_statement);
+ //lasso_samlp_response_add_assertion(authn->response, assertion);
+ }
+
+ /* return a response message */
+ protocolProfile = lasso_node_get_child_content(authn->request, "ProtocolProfile", NULL);
+ if (xmlStrEqual(protocolProfile, lassoLibProtocolProfilePost)) {
+ str = lasso_node_export_to_base64(authn->response);
+ }
+ else {
+ printf("DEBUG - return a artifact message\n");
+ }
+
+ return(str);
+}
+
+/*****************************************************************************/
+/* instance and class init functions */
+/*****************************************************************************/
+
+static void
+lasso_authentication_instance_init(LassoAuthentication *authn)
+{
+ authn->user = NULL;
+ authn->message = NULL;
+ authn->request = NULL;
+ authn->response = NULL;
+ authn->local_providerID = NULL;
+ authn->peer_providerID = NULL;
+ authn->request_protocol_method = 0;
+}
+
+static void
+lasso_authentication_class_init(LassoAuthenticationClass *class)
+{
+}
+
+GType lasso_authentication_get_type() {
+ static GType this_type = 0;
+
+ if (!this_type) {
+ static const GTypeInfo this_info = {
+ sizeof (LassoAuthenticationClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) lasso_authentication_class_init,
+ NULL,
+ NULL,
+ sizeof(LassoAuthentication),
+ 0,
+ (GInstanceInitFunc) lasso_authentication_instance_init,
+ };
+
+ this_type = g_type_register_static(LASSO_TYPE_PROFILE_CONTEXT,
+ "LassoAuthentication",
+ &this_info, 0);
+ }
+ return this_type;
+}
+
+LassoAuthentication*
+lasso_authentication_new(LassoServerAuthentication *server,
+ LassoUserAuthentication *user,
+ gchar *local_providerID,
+ gchar *peer_providerID)
+{
+ /* load the ProviderID name or a reference to the provider ? */
+ g_return_val_if_fail(local_providerID != NULL, NULL);
+ g_return_val_if_fail(peer_providerID != NULL, NULL);
+
+ LassoAuthentication *authn;
+
+ authn = g_object_new(LASSO_TYPE_AUTHENTICATION, NULL);
+
+ ->server = server;
+
+ if (user != NULL) {
+ authn->user = user;
+ }
+
+ lasso_authentication_set_local_providerID(authn, local_providerID);
+ lasso_authentication_set_peer_providerID(authn, peer_providerID);
+
+ return ();
+}
diff --git a/lasso/id-ff/authentication.h b/lasso/id-ff/authentication.h
new file mode 100644
index 00000000..31215cff
--- /dev/null
+++ b/lasso/id-ff/authentication.h
@@ -0,0 +1,92 @@
+/* $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_AUTHENTIFICATION_H__
+#define __LASSO_AUTHENTIFICATION_H__
+
+#ifdef __cplusplus
+extern "C" {
+
+#endif /* __cplusplus */
+
+#include <lasso/xml/xml.h>
+#include <lasso/environs/profile_context.h>
+#include <lasso/environs/provider.h>
+#include <lasso/environs/server_context.h>
+#include <lasso/environs/user_context.h>
+
+#define LASSO_TYPE_AUTHENTICATION (lasso_authentication_get_type())
+#define LASSO_AUTHENTICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_AUTHENTICATION, LassoAuthentication))
+#define LASSO_AUTHENTICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_AUTHENTICATION, LassoAuthenticationClass))
+#define LASSO_IS_AUTHENTICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_AUTHENTICATION))
+#define LASSP_IS_AUTHENTICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_AUTHENTICATION))
+#define LASSO_AUTHENTICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_AUTHENTICATION, LassoAuthenticationClass))
+
+typedef struct _LassoAuthentication LassoAuthentication;
+typedef struct _LassoAuthenticationClass LassoAuthenticationClass;
+
+struct _LassoAuthentication {
+ LassoProfileContext parent;
+ /*< public >*/
+ /*< private >*/
+};
+
+struct _LassoAuthenticationClass {
+ LassoProfileContextClass parent;
+};
+
+LASSO_EXPORT GType lasso_authentication_get_type (void);
+
+LASSO_EXPORT LassoAuthentication* lasso_authentication_new (LassoServerAuthentication *server,
+ LassoUserAuthentication *user,
+ gchar *local_providerID,
+ gchar *peer_providerID);
+
+LASSO_EXPORT gchar* lasso_authentication_build_request (LassoAuthentication *authn,
+ const gchar *responseProtocolProfile,
+ gboolean isPassive,
+ gboolean forceAuthn,
+ const gchar *nameIDPolicy);
+
+LASSO_EXPORT xmlChar* lasso_authentication_process_artifact (LassoAuthentication *authn,
+ gchar *artifact);
+
+LASSO_EXPORT gboolean lasso_authentication_process_response (LassoAuthentication *authn,
+ xmlChar *response);
+
+LASSO_EXPORT gboolean lasso_authentication_process_request (LassoAuthentication *authn,
+ gchar *request,
+ gint request_method,
+ gboolean is_authenticated);
+
+LASSO_EXPORT gchar* lasso_authentication_process_authentication_result (LassoAuthentication *authn,
+ gint authentication_result,
+ const char *authentication_method);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LASSO_AUTHENTICATION_H__ */
diff --git a/lasso/id-ff/profile_context.c b/lasso/id-ff/profile_context.c
new file mode 100644
index 00000000..0ba84434
--- /dev/null
+++ b/lasso/id-ff/profile_context.c
@@ -0,0 +1,211 @@
+/* $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/xml/samlp_response.h>
+#include <lasso/protocols/request.h>
+#include <lasso/protocols/response.h>
+#include <lasso/protocols/authn_response.h>
+#include <lasso/environs/context.h>
+
+/*****************************************************************************/
+/* functions */
+/*****************************************************************************/
+
+static void
+set_response_status(LassoNode *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 */
+/*****************************************************************************/
+
+gint
+lasso_profile_context_set_local_providerID(LassoProfileContext *ctx,
+ gchar *providerID)
+{
+ if (ctx->local_providerID) {
+ free(ctx->local_providerID);
+ }
+ ctx->local_providerID = (char *)malloc(strlen(providerID)+1);
+ strcpy(ctx->local_providerID, providerID);
+
+ return (1);
+}
+
+gint
+lasso_profile_context_set_peer_providerID(LassoProfileContext *ctx,
+ gchar *providerID)
+{
+ if (ctx->peer_providerID) {
+ free(ctx->peer_providerID);
+ }
+ ctx->peer_providerID = (char *)malloc(strlen(providerID)+1);
+ strcpy(ctx->peer_providerID, providerID);
+
+ return (1);
+}
+
+/*****************************************************************************/
+/* instance and class init functions */
+/*****************************************************************************/
+
+enum {
+ LASSO_PROFILE_CONTEXT_SERVER = 1,
+ LASSO_PROFILE_CONTEXT_USER = 2,
+};
+
+static void
+lasso_profile_context_instance_init(GTypeInstance *instance,
+ gpointer g_class)
+{
+ LassoProfileContext *ctx = LASSO_PROFILE_CONTEXT(instance);
+
+ ctx->user = NULL;
+ ctx->request = NULL;
+ ctx->response = NULL;
+ ctx->local_providerID = NULL;
+ ctx->peer_providerID = NULL;
+ ctx->request_protocol_method = 0;
+}
+
+static void
+lasso_profile_context_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ LassoProfileContext *self = LASSO_PROFILE_CONTEXT(object);
+
+ switch (property_id) {
+ case LASSO_PROFILE_CONTEXT_SERVER: {
+ g_object_unref(self->server);
+ self->server = g_value_get_pointer (value);
+ }
+ break;
+ case LASSO_PROFILE_CONTEXT_USER: {
+ g_object_unref(self->user);
+ self->user = g_value_get_pointer (user);
+ }
+ break;
+ default:
+ /* We don't have any other property... */
+ g_assert (FALSE);
+ break;
+ }
+}
+
+static void
+lasso_profile_context_class_init(gpointer g_class,
+ gpointer g_class_data)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+ LassoProfileContextClass *klass = LASSO_PROFILE_CONTEXT_CLASS (g_class);
+ GParamSpec *pspec;
+
+ gobject_class->set_property = lasso_profile_context_set_property;
+
+ pspec = g_param_spec_pointer ("server",
+ "servers metadata and keys/cert",
+ "Set datas of server",
+ NULL /* default value */,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+ g_object_class_install_property (gobject_class,
+ LASSO_PROFILE_CONTEXT_SERVER,
+ pspec);
+
+ pspec = g_param_spec_pointer ("user",
+ "user assertion and identities",
+ "Set user's datas",
+ NULL /* default value */,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+ g_object_class_install_property (gobject_class,
+ LASSO_PROFILE_CONTEXT_USER,
+ pspec);
+}
+
+GType lasso_profile_context_get_type() {
+ static GType this_type = 0;
+
+ if (!this_type) {
+ static const GTypeInfo this_info = {
+ sizeof (LassoProfileContextClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) lasso_profile_context_class_init,
+ NULL,
+ NULL,
+ sizeof(LassoProfileContext),
+ 0,
+ (GInstanceInitFunc) lasso_profile_context_instance_init,
+ };
+
+ this_type = g_type_register_static(G_TYPE_OBJECT,
+ "LassoProfileContext",
+ &this_info, 0);
+ }
+ return this_type;
+}
+
+LassoProfileContext*
+lasso_profile_context_new(LassoServerProfileContext *server,
+ LassoUserProfileContext *user,
+ gchar *local_providerID,
+ gchar *peer_providerID)
+{
+ /* load the ProviderID name or a reference to the provider ? */
+ g_return_val_if_fail(local_providerID != NULL, NULL);
+ g_return_val_if_fail(peer_providerID != NULL, NULL);
+
+ LassoProfileContext *ctx;
+
+ ctx = g_object_new(LASSO_TYPE_PROFILE_CONTEXT, NULL);
+
+ ctx->server = server;
+
+ if (user != NULL) {
+ ctx->user = user;
+ }
+
+ lasso_profile_context_set_local_providerID(ctx, local_providerID);
+ lasso_profile_context_set_peer_providerID(ctx, peer_providerID);
+
+ return (ctx);
+}
diff --git a/lasso/id-ff/profile_context.h b/lasso/id-ff/profile_context.h
new file mode 100644
index 00000000..7cbca139
--- /dev/null
+++ b/lasso/id-ff/profile_context.h
@@ -0,0 +1,95 @@
+/* $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_PROFILE_CONTEXT_H__
+#define __LASSO_PROFILE_CONTEXT_H__
+
+#ifdef __cplusplus
+extern "C" {
+
+#endif /* __cplusplus */
+
+#include <lasso/xml/xml.h>
+#include <lasso/environs/server.h>
+#include <lasso/environs/user.h>
+
+#define LASSO_TYPE_PROFILE_CONTEXT (lasso_profile_context_get_type())
+#define LASSO_PROFILE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_PROFILE_CONTEXT, LassoProfileContext))
+#define LASSO_PROFILE_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_PROFILE_CONTEXT, LassoProfileContextClass))
+#define LASSO_IS_PROFILE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_PROFILE_CONTEXT))
+#define LASSP_IS_PROFILE_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_PROFILE_CONTEXT))
+#define LASSO_PROFILE_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_PROFILE_CONTEXT, LassoProfileContextClass))
+
+typedef struct _LassoProfileContext LassoProfileContext;
+typedef struct _LassoProfileContextClass LassoProfileContextClass;
+
+typedef enum {
+ lassoProfileContextMethodGet = 1,
+ lassoProfileContextMethodRedirect,
+ lassoProfileContextMethodPost,
+ lassoProfileContextMethodSoap,
+ lassoProfileContextMethodArtifact,
+} lassoProfileContextMethods;
+
+struct _LassoProfileContext {
+ GObject parent;
+
+ /*< public >*/
+ LassoServer *server;
+ LassoUser *user;
+
+ LassoNode *request;
+ LassoNode *response;
+
+ gchar *local_providerID;
+ gchar *peer_providerID;
+
+ gint request_protocol_method;
+
+ /*< private >*/
+};
+
+struct _LassoProfileContextClass {
+ GObjectClass parent;
+};
+
+LASSO_EXPORT GType lasso_profile_context_get_type (void);
+
+LASSO_EXPORT LassoProfileContext* lasso_profile_context_new (LassoServer *server,
+ LassoUser *user,
+ gchar *local_providerID,
+ gchar *peer_providerID);
+
+LASSO_EXPORT gint lasso_profile_context_set_local_providerID (LassoProfileContext *ctx,
+ gchar *providerID);
+
+LASSO_EXPORT gint lasso_profile_context_set_peer_providerID (LassoProfileContext *ctx,
+ gchar *providerID);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LASSO_PROFILE_CONTEXT_H__ */