summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Laniel <dlaniel@entrouvert.com>2007-04-16 14:02:13 +0000
committerDamien Laniel <dlaniel@entrouvert.com>2007-04-16 14:02:13 +0000
commitbaacab38c79f63a986970a24be5183a0843d90ee (patch)
tree7964695485b45038e967be113ebdcf26a2e32092
parent54bcb9d7be26b2343aa148108c250b4d30967281 (diff)
identity + session in discovery + SvcMDAssociationAdd
-rw-r--r--lasso/id-wsf-2.0/discovery.c103
-rw-r--r--lasso/id-wsf-2.0/discovery.h9
-rw-r--r--lasso/id-wsf-2.0/wsf2_profile.c115
-rw-r--r--lasso/id-wsf-2.0/wsf2_profile.h13
-rw-r--r--lasso/xml/id-wsf-2.0/Makefile.am4
-rw-r--r--swig/Lasso-wsf2.i58
6 files changed, 298 insertions, 4 deletions
diff --git a/lasso/id-wsf-2.0/discovery.c b/lasso/id-wsf-2.0/discovery.c
index 87a35a98..a81d50da 100644
--- a/lasso/id-wsf-2.0/discovery.c
+++ b/lasso/id-wsf-2.0/discovery.c
@@ -32,6 +32,8 @@
#include <lasso/xml/id-wsf-2.0/disco_svc_md_register.h>
#include <lasso/xml/id-wsf-2.0/disco_svc_md_register_response.h>
+#include <lasso/xml/id-wsf-2.0/disco_svc_md_association_add.h>
+#include <lasso/xml/id-wsf-2.0/disco_svc_md_association_add_response.h>
#include <lasso/id-ff/server.h>
#include <lasso/id-ff/provider.h>
@@ -126,9 +128,11 @@ lasso_idwsf2_discovery_process_metadata_register_msg(LassoIdWsf2Discovery *disco
/* Process request */
res = lasso_wsf2_profile_process_soap_request_msg(LASSO_WSF2_PROFILE(discovery), message);
+ /* If the request has been correctly processed, */
+ /* put interesting datas into the discovery object */
if (res == 0) {
- request =
- LASSO_IDWSF2_DISCO_SVC_MD_REGISTER(LASSO_WSF2_PROFILE(discovery)->request);
+ request = LASSO_IDWSF2_DISCO_SVC_MD_REGISTER(
+ LASSO_WSF2_PROFILE(discovery)->request);
/* FIXME : foreach on the list instead */
if (request->metadata_list != NULL) {
discovery->metadata =
@@ -140,6 +144,7 @@ lasso_idwsf2_discovery_process_metadata_register_msg(LassoIdWsf2Discovery *disco
/* Build response */
response = LASSO_IDWSF2_DISCO_SVC_MD_REGISTER_RESPONSE(
lasso_idwsf2_disco_svc_md_register_response_new());
+
/* FIXME : Replace status codes with a constant ? */
if (res == 0) {
response->Status = lasso_util_status_new("OK");
@@ -171,6 +176,8 @@ lasso_idwsf2_discovery_process_metadata_register_response_msg(LassoIdWsf2Discove
/* Process request */
res = lasso_wsf2_profile_process_soap_response_msg(LASSO_WSF2_PROFILE(discovery), message);
+ /* If the response has been correctly processed, */
+ /* put interesting datas into the discovery object */
if (res == 0) {
response = LASSO_IDWSF2_DISCO_SVC_MD_REGISTER_RESPONSE(
LASSO_WSF2_PROFILE(discovery)->response);
@@ -183,6 +190,98 @@ lasso_idwsf2_discovery_process_metadata_register_response_msg(LassoIdWsf2Discove
return res;
}
+
+gint
+lasso_idwsf2_discovery_init_metadata_association_add(LassoIdWsf2Discovery *discovery,
+ const gchar *svcMDID, const gchar *disco_provider_id)
+{
+ LassoIdWsf2DiscoSvcMDAssociationAdd *md_association_add;
+
+ /* Get a MetadataRegister node */
+ md_association_add = LASSO_IDWSF2_DISCO_SVC_MD_ASSOCIATION_ADD(
+ lasso_idwsf2_disco_svc_md_association_add_new());
+ md_association_add->SvcMDID = g_list_append(md_association_add->SvcMDID, g_strdup(svcMDID));
+
+ /* Create request with this xml node */
+ lasso_wsf2_profile_init_soap_request(LASSO_WSF2_PROFILE(discovery),
+ LASSO_NODE(md_association_add));
+
+ /* FIXME : Get the url of the disco service where we must send the soap request */
+ /* LASSO_WSF2_PROFILE(discovery)->msg_url = g_strdup(disco_provider_id); */
+
+ return 0;
+}
+
+gint
+lasso_idwsf2_discovery_process_metadata_association_add_msg(LassoIdWsf2Discovery *discovery,
+ const gchar *message)
+{
+ LassoIdWsf2DiscoSvcMDAssociationAdd *request;
+ LassoIdWsf2DiscoSvcMDAssociationAddResponse *response;
+ LassoSoapEnvelope *envelope;
+ int res = 0;
+
+ g_return_val_if_fail(LASSO_IS_IDWSF2_DISCOVERY(discovery),
+ LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
+ g_return_val_if_fail(message != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+
+ /* Process request */
+ res = lasso_wsf2_profile_process_soap_request_msg(LASSO_WSF2_PROFILE(discovery), message);
+
+ /* If the request has been correctly processed, */
+ /* put interesting datas into the discovery object */
+ if (res == 0) {
+ request = LASSO_IDWSF2_DISCO_SVC_MD_ASSOCIATION_ADD(
+ LASSO_WSF2_PROFILE(discovery)->request);
+ /* FIXME : foreach on the list instead */
+ if (request->SvcMDID != NULL) {
+ discovery->svcMDID = request->SvcMDID->data;
+ }
+ }
+
+ /* Build response */
+ response = LASSO_IDWSF2_DISCO_SVC_MD_ASSOCIATION_ADD_RESPONSE(
+ lasso_idwsf2_disco_svc_md_association_add_response_new());
+ /* FIXME : Replace status codes with a constant ? */
+ if (res == 0) {
+ response->Status = lasso_util_status_new("OK");
+ } else {
+ response->Status = lasso_util_status_new("Failed");
+ /* XXX : May add secondary status codes here */
+ }
+
+ envelope = LASSO_WSF2_PROFILE(discovery)->soap_envelope_response;
+ envelope->Body->any = g_list_append(envelope->Body->any, response);
+
+ return res;
+}
+
+gint
+lasso_idwsf2_discovery_process_metadata_association_add_response_msg(
+ LassoIdWsf2Discovery *discovery, const gchar *message)
+{
+ LassoIdWsf2DiscoSvcMDAssociationAddResponse *response;
+ LassoSoapEnvelope *envelope;
+ int res = 0;
+
+ g_return_val_if_fail(LASSO_IS_IDWSF2_DISCOVERY(discovery),
+ LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
+ g_return_val_if_fail(message != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+
+ /* Process request */
+ res = lasso_wsf2_profile_process_soap_response_msg(LASSO_WSF2_PROFILE(discovery), message);
+
+ /* If the response has been correctly processed, */
+ /* put interesting datas into the discovery object */
+ if (res == 0) {
+ response = LASSO_IDWSF2_DISCO_SVC_MD_ASSOCIATION_ADD_RESPONSE(
+ LASSO_WSF2_PROFILE(discovery)->response);
+ /* FIXME : Check status here and in other functions as well */
+ }
+
+ return res;
+}
+
/*****************************************************************************/
/* private methods */
/*****************************************************************************/
diff --git a/lasso/id-wsf-2.0/discovery.h b/lasso/id-wsf-2.0/discovery.h
index 4577b508..a8187c95 100644
--- a/lasso/id-wsf-2.0/discovery.h
+++ b/lasso/id-wsf-2.0/discovery.h
@@ -81,6 +81,15 @@ LASSO_EXPORT gint lasso_idwsf2_discovery_process_metadata_register_msg(
LASSO_EXPORT gint lasso_idwsf2_discovery_process_metadata_register_response_msg(
LassoIdWsf2Discovery *discovery, const gchar *message);
+
+LASSO_EXPORT gint lasso_idwsf2_discovery_init_metadata_association_add(
+ LassoIdWsf2Discovery *discovery, const gchar *svcMDID, const gchar *disco_provider_id);
+
+LASSO_EXPORT gint lasso_idwsf2_discovery_process_metadata_association_add_msg(
+ LassoIdWsf2Discovery *discovery, const gchar *message);
+
+LASSO_EXPORT gint lasso_idwsf2_discovery_process_metadata_association_add_response_msg(
+ LassoIdWsf2Discovery *discovery, const gchar *message);
LASSO_EXPORT gint lasso_idwsf2_discovery_init_query(LassoIdWsf2Discovery *discovery,
const gchar *security_mech_id);
diff --git a/lasso/id-wsf-2.0/wsf2_profile.c b/lasso/id-wsf-2.0/wsf2_profile.c
index 74454f0d..a48e13e2 100644
--- a/lasso/id-wsf-2.0/wsf2_profile.c
+++ b/lasso/id-wsf-2.0/wsf2_profile.c
@@ -85,6 +85,121 @@ lasso_wsf2_profile_build_soap_envelope(const char *refToMessageId, const char *p
/* public methods */
/*****************************************************************************/
+/**
+ * lasso_wsf2_profile_get_identity:
+ * @profile: a #LassoWsf2Profile
+ *
+ * Gets the identity bound to @profile.
+ *
+ * Return value: the identity or NULL if it none was found. The #LassoIdentity
+ * object is internally allocated and must not be freed by the caller.
+ **/
+LassoIdentity*
+lasso_wsf2_profile_get_identity(LassoWsf2Profile *profile)
+{
+ if (profile->identity && g_hash_table_size(profile->identity->federations))
+ return profile->identity;
+ return NULL;
+}
+
+
+/**
+ * lasso_wsf2_profile_get_session:
+ * @profile: a #LassoWsf2Profile
+ *
+ * Gets the session bound to @profile.
+ *
+ * Return value: the session or NULL if it none was found. The #LassoSession
+ * object is internally allocated and must not be freed by the caller.
+ **/
+LassoSession*
+lasso_wsf2_profile_get_session(LassoWsf2Profile *profile)
+{
+ if (profile->session == NULL)
+ return NULL;
+
+ if (lasso_session_is_empty(profile->session))
+ return NULL;
+
+ return profile->session;
+}
+
+
+/**
+ * lasso_wsf2_profile_is_identity_dirty:
+ * @profile: a #LassoWsf2Profile
+ *
+ * Checks whether identity has been modified (and should therefore be saved).
+ *
+ * Return value: %TRUE if identity has changed
+ **/
+gboolean
+lasso_wsf2_profile_is_identity_dirty(LassoWsf2Profile *profile)
+{
+ return (profile->identity && profile->identity->is_dirty);
+}
+
+
+/**
+ * lasso_wsf2_profile_is_session_dirty:
+ * @profile: a #LassoWsf2Profile
+ *
+ * Checks whether session has been modified (and should therefore be saved).
+ *
+ * Return value: %TRUE if session has changed
+ **/
+gboolean
+lasso_wsf2_profile_is_session_dirty(LassoWsf2Profile *profile)
+{
+ return (profile->session && profile->session->is_dirty);
+}
+
+
+/**
+ * lasso_wsf2_profile_set_identity_from_dump:
+ * @profile: a #LassoWsf2Profile
+ * @dump: XML identity dump
+ *
+ * Builds a new #LassoIdentity object from XML dump and binds it to @profile.
+ *
+ * Return value: 0 on success; or a negative value otherwise.
+ **/
+gint
+lasso_wsf2_profile_set_identity_from_dump(LassoWsf2Profile *profile, const gchar *dump)
+{
+ g_return_val_if_fail(dump != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+
+ profile->identity = lasso_identity_new_from_dump(dump);
+ if (profile->identity == NULL)
+ return critical_error(LASSO_PROFILE_ERROR_BAD_IDENTITY_DUMP);
+
+ return 0;
+}
+
+
+/**
+ * lasso_wsf2_profile_set_session_from_dump:
+ * @profile: a #LassoWsf2Profile
+ * @dump: XML session dump
+ *
+ * Builds a new #LassoSession object from XML dump and binds it to @profile.
+ *
+ * Return value: 0 on success; or a negative value otherwise.
+ **/
+gint
+lasso_wsf2_profile_set_session_from_dump(LassoWsf2Profile *profile, const gchar *dump)
+{
+ g_return_val_if_fail(dump != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+
+ profile->session = lasso_session_new_from_dump(dump);
+ if (profile->session == NULL)
+ return critical_error(LASSO_PROFILE_ERROR_BAD_SESSION_DUMP);
+ profile->session->is_dirty = FALSE;
+
+ return 0;
+}
+
+
gint
lasso_wsf2_profile_init_soap_request(LassoWsf2Profile *profile, LassoNode *request)
{
diff --git a/lasso/id-wsf-2.0/wsf2_profile.h b/lasso/id-wsf-2.0/wsf2_profile.h
index 47759990..4d6fc561 100644
--- a/lasso/id-wsf-2.0/wsf2_profile.h
+++ b/lasso/id-wsf-2.0/wsf2_profile.h
@@ -78,8 +78,17 @@ struct _LassoWsf2ProfileClass {
LASSO_EXPORT GType lasso_wsf2_profile_get_type(void);
-LASSO_EXPORT LassoSoapEnvelope* lasso_wsf2_profile_build_soap_envelope(const char *refToMessageId,
- const char *providerId);
+LASSO_EXPORT LassoIdentity* lasso_wsf2_profile_get_identity(LassoWsf2Profile *profile);
+LASSO_EXPORT LassoSession* lasso_wsf2_profile_get_session(LassoWsf2Profile *profile);
+LASSO_EXPORT gboolean lasso_wsf2_profile_is_identity_dirty(LassoWsf2Profile *profile);
+LASSO_EXPORT gboolean lasso_wsf2_profile_is_session_dirty(LassoWsf2Profile *profile);
+LASSO_EXPORT gint lasso_wsf2_profile_set_identity_from_dump(LassoWsf2Profile *profile,
+ const gchar *dump);
+LASSO_EXPORT gint lasso_wsf2_profile_set_session_from_dump(LassoWsf2Profile *profile,
+ const gchar *dump);
+
+/* LASSO_EXPORT LassoSoapEnvelope* lasso_wsf2_profile_build_soap_envelope(const char *refToMessageId, */
+/* const char *providerId); */
LASSO_EXPORT gint lasso_wsf2_profile_build_soap_request_msg(LassoWsf2Profile *profile);
diff --git a/lasso/xml/id-wsf-2.0/Makefile.am b/lasso/xml/id-wsf-2.0/Makefile.am
index 5caff126..e8fe4a1c 100644
--- a/lasso/xml/id-wsf-2.0/Makefile.am
+++ b/lasso/xml/id-wsf-2.0/Makefile.am
@@ -15,6 +15,8 @@ liblasso_xml_id_wsf2_la_SOURCES = \
disco_query_response.c \
disco_service_context.c \
disco_svc_metadata.c \
+ disco_svc_md_association_add.c \
+ disco_svc_md_association_add_response.c \
disco_svc_md_register.c \
disco_svc_md_register_response.c \
soap_binding_framework.c \
@@ -27,6 +29,8 @@ liblassoinclude_HEADERS = \
disco_query_response.h \
disco_service_context.h \
disco_svc_metadata.h \
+ disco_svc_md_association_add.h \
+ disco_svc_md_association_add_response.h \
disco_svc_md_register.h \
disco_svc_md_register_response.h \
soap_binding_framework.h \
diff --git a/swig/Lasso-wsf2.i b/swig/Lasso-wsf2.i
index 88f2dfb1..08de555f 100644
--- a/swig/Lasso-wsf2.i
+++ b/swig/Lasso-wsf2.i
@@ -53,6 +53,18 @@ typedef struct {
/* Attributes inherited from Wsf2Profile */
+ %newobject identity_get;
+ LassoIdentity *identity;
+
+ %newobject session_get;
+ LassoSession *session;
+
+ %immutable isIdentityDirty;
+ gboolean isIdentityDirty;
+
+ %immutable isSessionDirty;
+ gboolean isSessionDirty;
+
%immutable msgBody;
char *msgBody;
@@ -91,6 +103,14 @@ typedef struct {
/* Methods inherited from Wsf2Profile */
THROW_ERROR()
+ int setIdentityFromDump(char *dump);
+ END_THROW_ERROR()
+
+ THROW_ERROR()
+ int setSessionFromDump(char *dump);
+ END_THROW_ERROR()
+
+ THROW_ERROR()
int buildRequestMsg();
END_THROW_ERROR()
@@ -113,6 +133,18 @@ typedef struct {
END_THROW_ERROR()
THROW_ERROR()
+ int initMetadataAssociationAdd(const char *svcMDID, const char *disco_provider_id);
+ END_THROW_ERROR()
+
+ THROW_ERROR()
+ int processMetadataAssociationAddMsg(const gchar *message);
+ END_THROW_ERROR()
+
+ THROW_ERROR()
+ int processMetadataAssociationAddResponseMsg(const gchar *message);
+ END_THROW_ERROR()
+
+ THROW_ERROR()
int initQuery(const char *security_mech_id = NULL);
END_THROW_ERROR()
}
@@ -121,6 +153,26 @@ typedef struct {
/* Attributes inherited from Wsf2Profile implementations */
+/* identity */
+#define LassoIdWsf2Discovery_get_identity(self) lasso_wsf2_profile_get_identity(LASSO_WSF2_PROFILE(self))
+#define LassoIdWsf2Discovery_identity_get(self) lasso_wsf2_profile_get_identity(LASSO_WSF2_PROFILE(self))
+#define LassoIdWsf2Discovery_set_identity(self, value) set_node((gpointer *) &LASSO_WSF2_PROFILE(self)->identity, (value))
+#define LassoIdWsf2Discovery_identity_set(self, value) set_node((gpointer *) &LASSO_WSF2_PROFILE(self)->identity, (value))
+
+/* isIdentityDirty */
+#define LassoIdWsf2Discovery_get_isIdentityDirty(self) lasso_wsf2_profile_is_identity_dirty(LASSO_WSF2_PROFILE(self))
+#define LassoIdWsf2Discovery_isIdentityDirty_get(self) lasso_wsf2_profile_is_identity_dirty(LASSO_WSF2_PROFILE(self))
+
+/* session */
+#define LassoIdWsf2Discovery_get_session(self) lasso_wsf2_profile_get_session(LASSO_WSF2_PROFILE(self))
+#define LassoIdWsf2Discovery_session_get(self) lasso_wsf2_profile_get_session(LASSO_WSF2_PROFILE(self))
+#define LassoIdWsf2Discovery_set_session(self, value) set_node((gpointer *) &LASSO_WSF2_PROFILE(self)->session, (value))
+#define LassoIdWsf2Discovery_session_set(self, value) set_node((gpointer *) &LASSO_WSF2_PROFILE(self)->session, (value))
+
+/* isSessionDirty */
+#define LassoIdWsf2Discovery_get_isSessionDirty(self) lasso_wsf2_profile_is_session_dirty(LASSO_WSF2_PROFILE(self))
+#define LassoIdWsf2Discovery_isSessionDirty_get(self) lasso_wsf2_profile_is_session_dirty(LASSO_WSF2_PROFILE(self))
+
/* msgBody */
#define LassoIdWsf2Discovery_get_msgBody(self) LASSO_WSF2_PROFILE(self)->msg_body
#define LassoIdWsf2Discovery_msgBody_get(self) LASSO_WSF2_PROFILE(self)->msg_body
@@ -178,6 +230,9 @@ typedef struct {
/* Implementations of methods inherited from Wsf2Profile */
+#define LassoIdWsf2Discovery_setIdentityFromDump(self, dump) lasso_wsf2_profile_set_identity_from_dump(LASSO_WSF2_PROFILE(self), dump)
+#define LassoIdWsf2Discovery_setSessionFromDump(self, dump) lasso_wsf2_profile_set_session_from_dump(LASSO_WSF2_PROFILE(self), dump)
+
#define LassoIdWsf2Discovery_buildRequestMsg(self) lasso_wsf2_profile_build_soap_request_msg(LASSO_WSF2_PROFILE(self))
#define LassoIdWsf2Discovery_buildResponseMsg(self) lasso_wsf2_profile_build_soap_response_msg(LASSO_WSF2_PROFILE(self))
@@ -186,6 +241,9 @@ typedef struct {
#define LassoIdWsf2Discovery_initMetadataRegister lasso_idwsf2_discovery_init_metadata_register
#define LassoIdWsf2Discovery_processMetadataRegisterMsg lasso_idwsf2_discovery_process_metadata_register_msg
#define LassoIdWsf2Discovery_processMetadataRegisterResponseMsg lasso_idwsf2_discovery_process_metadata_register_response_msg
+#define LassoIdWsf2Discovery_initMetadataAssociationAdd lasso_idwsf2_discovery_init_metadata_association_add
+#define LassoIdWsf2Discovery_processMetadataAssociationAddMsg lasso_idwsf2_discovery_process_metadata_association_add_msg
+#define LassoIdWsf2Discovery_processMetadataAssociationAddResponseMsg lasso_idwsf2_discovery_process_metadata_association_add_response_msg
#define LassoIdWsf2Discovery_initQuery lasso_idwsf2_discovery_init_query
%}