2005-01-13 00:24:48 +01:00
|
|
|
/* $Id$
|
|
|
|
*
|
|
|
|
* Lasso - A free implementation of the Liberty Alliance specifications.
|
|
|
|
*
|
2007-05-30 19:17:45 +02:00
|
|
|
* Copyright (C) 2004-2007 Entr'ouvert
|
2005-01-13 00:24:48 +01:00
|
|
|
* http://lasso.entrouvert.org
|
2008-09-12 17:06:58 +02:00
|
|
|
*
|
2005-01-22 16:57:56 +01:00
|
|
|
* Authors: See AUTHORS file in top-level directory.
|
2005-01-13 00:24:48 +01:00
|
|
|
*
|
|
|
|
* 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.
|
2008-09-12 17:06:58 +02:00
|
|
|
*
|
2005-01-13 00:24:48 +01:00
|
|
|
* 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.
|
2008-09-12 17:06:58 +02:00
|
|
|
*
|
2005-01-13 00:24:48 +01:00
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
ID-WSF: Lots of modifications
Migrate lots of code to use new utility macros. Try to simplify most
code paths or to factorize with LassoWsfProfile.
* lasso/id-wsf/wsf_profile.c:
Add API:
- lasso_wsf_profile_build_soap_response_msg to build SOAP fault for
Lasso errors,
- lasso_wsf_profile_set_msg_url_from_description, to set the
destination URL using the chosen LassoDiscoDescription (with
respect to the security mechanism),
- lasso_wsf_profile_init_soap_response to initialize a response to
the current request, to use in sub classes,
- lasso_wsf_profile_get_remote_provider_id, retrieve the SOAP
binding corresponding information,
- lasso_wsf_profile_get_remote_provider, simplification of
lasso_wsf_profile_get_remote_provider_id,
- lasso_wsf_profile_get_soap_fault, retrieve the last setted SOAP
fault, used by sub classes,
- lasso_wsf_profile_set_soap_fault, set a SOAP fault, to be returned
by the next call by lasso_wsf_profile_build_soap_response_msg, to
use in sub classes,
- lasso_wsf_profile_set/get_status_code, set/get the stored status
code, to use in the next lasso_xxx_build_response_message, to use
in sub classes.
Change name lasso_wsf_profile_get_description_autos to
lasso_wsf_profile_get_description_auto.
Do not access directly the session is_dirty field (it has been
sealed).
* lasso/id-wsf/wsf_profile.h:
Add helper macro lasso_wsf_profile_helper_set_status to set status
code of an ID-WSF response message containing a Status element using
the stored status code.
* lasso/id-wsf/wsf_profile_private.h:
Add new fields (moved public fields).
Add lasso_wsf_profile_set_msg_url_from_description,
lasso_wsf_profile_build_soap_fault_response_msg.
* lasso/id-wsf/data_service_private.h:
Remove file.
* lasso/id-wsf/data_service.h: Remove all public fields.
* lasso/id-wsf/data_service.c:
Remove private structure. Use the equivalents LassoWsfProfile private
fields. Update documentation. Use LassoWsfProfile generic functions
for initializing requests. Add API lasso_data_service_get_query_item,
lasso_data_service_get_answers, lasso_data_service_get_answer,
lasso_data_service_get_answers_by_select,
lasso_data_service_get_answer_for_item_id,
lasso_data_service_add_modification.
Remove lasso_data_service_need_redirect_user use equivalent function
lasso_interaction_profile_service_build_redirect_response_msg. Remove
lasso_data_service_get_resource_offering,
lasso_data_service_set_offering.
* lasso/id-wsf/discovery.c:
Add documentation. Change some signatures. Remove
lasso_discovery_get_description_auto. Change name of
lasso_discovery_init_insert to lasso_discovery_init_modify. Add a
generic lasso_discovery_process_request_msg.
Add internal function lasso_discovery_init_offering, to get
automatically an offering if possible. Remove useless init_from_xml.
Rework lasso_discovery_build_credential implementation.
overloading. Remove lasso_discovery_destroy.
* lasso/id-wsf/discovery.h:
Remove lasso_discovery_destroy.
* lasso/id-wsf/interaction_profile_service.c:
Add lasso_interaction_profile_service_build_redirect_response_msg.
* lasso/id-wsf/personal_profile_service.c:
Update lasso_personal_profile_service_get_email to use
lasso_data_service_get_answers_by_select.
* lasso/xml/dst_modify.c:
make modification parameter optional to the constructor.
2009-08-26 17:13:46 +02:00
|
|
|
#include "./interaction_profile_service.h"
|
|
|
|
#include "./wsf_profile.h"
|
|
|
|
#include "../xml/soap_detail.h"
|
|
|
|
#include "../xml/soap_fault.h"
|
|
|
|
#include "../xml/is_redirect_request.h"
|
|
|
|
#include "../utils.h"
|
2005-01-13 00:24:48 +01:00
|
|
|
|
2009-08-26 17:15:07 +02:00
|
|
|
/**
|
|
|
|
* SECTION:interaction_profile_service
|
|
|
|
* @short_description: A service to request user interaction from a principal
|
|
|
|
* @stability: Unstable
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2005-01-13 00:24:48 +01:00
|
|
|
struct _LassoInteractionProfileServicePrivate
|
|
|
|
{
|
|
|
|
gboolean dispose_has_run;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* public methods */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
gint
|
|
|
|
lasso_interaction_profile_service_init_request(LassoInteractionProfileService *service)
|
|
|
|
{
|
|
|
|
LassoWsfProfile *profile;
|
|
|
|
LassoIsInteractionRequest *request;
|
|
|
|
|
|
|
|
profile = LASSO_WSF_PROFILE(service);
|
|
|
|
|
|
|
|
request = lasso_is_interaction_request_new();
|
|
|
|
|
|
|
|
profile->request = LASSO_NODE(request);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gint
|
|
|
|
lasso_interaction_profile_service_process_request_msg(LassoInteractionProfileService *service,
|
2008-08-05 16:53:29 +02:00
|
|
|
const gchar *msg)
|
2005-01-13 00:24:48 +01:00
|
|
|
{
|
|
|
|
LassoIsInteractionRequest *request;
|
|
|
|
|
|
|
|
request = lasso_is_interaction_request_new_from_message(msg);
|
|
|
|
LASSO_WSF_PROFILE(service)->request = LASSO_NODE(request);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
lasso_interaction_profile_service_process_response_msg(LassoInteractionProfileService *service,
|
2008-08-05 16:53:29 +02:00
|
|
|
const gchar *msg)
|
2005-01-13 00:24:48 +01:00
|
|
|
{
|
|
|
|
LassoIsInteractionResponse *response;
|
|
|
|
|
|
|
|
response = lasso_is_interaction_response_new_from_message(msg);
|
|
|
|
LASSO_WSF_PROFILE(service)->response = LASSO_NODE(response);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
ID-WSF: Lots of modifications
Migrate lots of code to use new utility macros. Try to simplify most
code paths or to factorize with LassoWsfProfile.
* lasso/id-wsf/wsf_profile.c:
Add API:
- lasso_wsf_profile_build_soap_response_msg to build SOAP fault for
Lasso errors,
- lasso_wsf_profile_set_msg_url_from_description, to set the
destination URL using the chosen LassoDiscoDescription (with
respect to the security mechanism),
- lasso_wsf_profile_init_soap_response to initialize a response to
the current request, to use in sub classes,
- lasso_wsf_profile_get_remote_provider_id, retrieve the SOAP
binding corresponding information,
- lasso_wsf_profile_get_remote_provider, simplification of
lasso_wsf_profile_get_remote_provider_id,
- lasso_wsf_profile_get_soap_fault, retrieve the last setted SOAP
fault, used by sub classes,
- lasso_wsf_profile_set_soap_fault, set a SOAP fault, to be returned
by the next call by lasso_wsf_profile_build_soap_response_msg, to
use in sub classes,
- lasso_wsf_profile_set/get_status_code, set/get the stored status
code, to use in the next lasso_xxx_build_response_message, to use
in sub classes.
Change name lasso_wsf_profile_get_description_autos to
lasso_wsf_profile_get_description_auto.
Do not access directly the session is_dirty field (it has been
sealed).
* lasso/id-wsf/wsf_profile.h:
Add helper macro lasso_wsf_profile_helper_set_status to set status
code of an ID-WSF response message containing a Status element using
the stored status code.
* lasso/id-wsf/wsf_profile_private.h:
Add new fields (moved public fields).
Add lasso_wsf_profile_set_msg_url_from_description,
lasso_wsf_profile_build_soap_fault_response_msg.
* lasso/id-wsf/data_service_private.h:
Remove file.
* lasso/id-wsf/data_service.h: Remove all public fields.
* lasso/id-wsf/data_service.c:
Remove private structure. Use the equivalents LassoWsfProfile private
fields. Update documentation. Use LassoWsfProfile generic functions
for initializing requests. Add API lasso_data_service_get_query_item,
lasso_data_service_get_answers, lasso_data_service_get_answer,
lasso_data_service_get_answers_by_select,
lasso_data_service_get_answer_for_item_id,
lasso_data_service_add_modification.
Remove lasso_data_service_need_redirect_user use equivalent function
lasso_interaction_profile_service_build_redirect_response_msg. Remove
lasso_data_service_get_resource_offering,
lasso_data_service_set_offering.
* lasso/id-wsf/discovery.c:
Add documentation. Change some signatures. Remove
lasso_discovery_get_description_auto. Change name of
lasso_discovery_init_insert to lasso_discovery_init_modify. Add a
generic lasso_discovery_process_request_msg.
Add internal function lasso_discovery_init_offering, to get
automatically an offering if possible. Remove useless init_from_xml.
Rework lasso_discovery_build_credential implementation.
overloading. Remove lasso_discovery_destroy.
* lasso/id-wsf/discovery.h:
Remove lasso_discovery_destroy.
* lasso/id-wsf/interaction_profile_service.c:
Add lasso_interaction_profile_service_build_redirect_response_msg.
* lasso/id-wsf/personal_profile_service.c:
Update lasso_personal_profile_service_get_email to use
lasso_data_service_get_answers_by_select.
* lasso/xml/dst_modify.c:
make modification parameter optional to the constructor.
2009-08-26 17:13:46 +02:00
|
|
|
/**
|
|
|
|
* lasso_interaction_profile_service_build_redirect_response_msg:
|
|
|
|
* @profile: a #LassoWsfProfile
|
|
|
|
* @redirect_url: an #xmlChar string containing an HTTP url for interaction with the user
|
|
|
|
*
|
|
|
|
* The redirect_url must contain a way for the interaction service to link this interaction with the
|
|
|
|
* current request, usually it is the xml:id of the original request.
|
|
|
|
*
|
|
|
|
* Return value: 0 if successful, an error code otherwise.
|
|
|
|
*/
|
|
|
|
gint
|
|
|
|
lasso_interaction_profile_service_build_redirect_response_msg(LassoWsfProfile *profile, char *redirect_url)
|
|
|
|
{
|
|
|
|
LassoSoapDetail *detail = NULL;
|
|
|
|
LassoSoapFault *fault = NULL;
|
|
|
|
|
|
|
|
lasso_bad_param(WSF_PROFILE, profile);
|
|
|
|
|
|
|
|
detail = lasso_soap_detail_new();
|
|
|
|
fault = lasso_soap_fault_new();
|
|
|
|
lasso_assign_new_gobject(fault->Detail, detail);
|
|
|
|
lasso_assign_string(fault->faultcode, LASSO_SOAP_FAULT_CODE_SERVER);
|
|
|
|
lasso_list_add_new_gobject(detail->any, lasso_is_redirect_request_new(redirect_url));
|
|
|
|
|
|
|
|
return lasso_wsf_profile_init_soap_response(profile, &fault->parent);
|
|
|
|
}
|
|
|
|
|
2005-01-13 00:24:48 +01:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* private methods */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static LassoInteractionProfileServiceClass *parent_class = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* instance and class init functions */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
static void
|
|
|
|
class_init(LassoInteractionProfileServiceClass *klass)
|
|
|
|
{
|
|
|
|
parent_class = g_type_class_peek_parent(klass);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
GType
|
|
|
|
lasso_interaction_profile_service_get_type()
|
|
|
|
{
|
|
|
|
static GType this_type = 0;
|
|
|
|
|
|
|
|
if (!this_type) {
|
|
|
|
static const GTypeInfo this_info = {
|
|
|
|
sizeof(LassoInteractionProfileServiceClass),
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
(GClassInitFunc) class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
sizeof(LassoInteractionProfileService),
|
|
|
|
0,
|
2008-09-16 18:31:05 +02:00
|
|
|
NULL,
|
2009-01-24 10:33:40 +01:00
|
|
|
NULL
|
2005-01-13 00:24:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
this_type = g_type_register_static(LASSO_TYPE_WSF_PROFILE,
|
|
|
|
"LassoInteractionProfileService", &this_info, 0);
|
|
|
|
}
|
|
|
|
return this_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
LassoInteractionProfileService*
|
|
|
|
lasso_interaction_profile_service_new(LassoServer *server)
|
|
|
|
{
|
|
|
|
LassoInteractionProfileService *service = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail(LASSO_IS_SERVER(server), NULL);
|
|
|
|
|
|
|
|
service = g_object_new(LASSO_TYPE_INTERACTION_PROFILE_SERVICE, NULL);
|
|
|
|
|
|
|
|
return service;
|
|
|
|
}
|