summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Dennis <jdennis@redhat.com>2015-05-28 17:39:20 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2015-08-24 14:05:29 (GMT)
commit43bcc8cddfca9b325b719e17c033b4ecc40eebd6 (patch)
treec4027e7495aed2158845698bf8883ce982115a0f
parentbdecdc248c337bd53b70a486b326e1d2d4e08d2c (diff)
downloadlasso-43bcc8cddfca9b325b719e17c033b4ecc40eebd6.zip
lasso-43bcc8cddfca9b325b719e17c033b4ecc40eebd6.tar.gz
lasso-43bcc8cddfca9b325b719e17c033b4ecc40eebd6.tar.bz2
Add messageID and idp_list to profile properties
ECP needs a place to store the messageID and idp_list. Normally values like this would located in a "context" passed to the relevant routines. But currently there is no such context, the closest thing to a context we have is the profile so we add them here in the profile private data using accessors. They are currently not relevant outside of ECP. Adds functions: lasso_profile_get_message_id() lasso_profile_set_message_id() lasso_profile_get_idp_list() lasso_profile_set_idp_list() Signed-off-by: John Dennis <jdennis@redhat.com> License: MIT
-rw-r--r--lasso/id-ff/profile.c70
-rw-r--r--lasso/id-ff/profile.h7
-rw-r--r--lasso/id-ff/profileprivate.h2
3 files changed, 79 insertions, 0 deletions
diff --git a/lasso/id-ff/profile.c b/lasso/id-ff/profile.c
index f261468..d07e868 100644
--- a/lasso/id-ff/profile.c
+++ b/lasso/id-ff/profile.c
@@ -523,6 +523,74 @@ lasso_profile_get_server(LassoProfile *profile)
}
+/**
+ * lasso_profile_get_message_id:
+ * @profile: a #LassoProfile object
+ *
+ * Return the messge ID.
+ *
+ * Return value:(transfer full)(allow-none): a newly allocated string or NULL
+ */
+char*
+lasso_profile_get_message_id(LassoProfile *profile)
+{
+ return g_strdup(profile->private_data->message_id);
+}
+
+/**
+ * lasso_profile_set_message_id:
+ * @profile: a #LassoProfile object
+ * @message_id: the message ID
+ *
+ * Set @message_id for the current conversation
+ *
+ */
+void
+lasso_profile_set_message_id(LassoProfile *profile, const char *message_id)
+{
+ if (! LASSO_IS_PROFILE(profile)) {
+ message(G_LOG_LEVEL_CRITICAL, "set_message_id called on something not a" \
+ "LassoProfile object: %p", profile);
+ return;
+ }
+ lasso_assign_string(profile->private_data->message_id, message_id);
+}
+
+/**
+ * lasso_profile_get_idp_list:
+ * @profile: a #LassoProfile object
+ *
+ * Return the messge ID.
+ *
+ * Return value: a #LassoNode, when using SAML 2.0 a #LassoSamlp2IDPList,
+ * when using ID-FF a #LassoLibIDPList.
+ */
+LassoNode*
+lasso_profile_get_idp_list(LassoProfile *profile)
+{
+ return profile->private_data->idp_list;
+}
+
+/**
+ * lasso_profile_set_idp_list:
+ * @profile: a #LassoProfile object
+ * @idp_list: a #LassoNode, when using SAML 2.0 a #LassoSamlp2IDPList,
+ * when using ID-FF a #LassoLibIDPList.
+ *
+ * Set @idp_list for the current conversation
+ *
+ */
+void
+lasso_profile_set_idp_list(LassoProfile *profile, const LassoNode *idp_list)
+{
+ if (! LASSO_IS_PROFILE(profile)) {
+ message(G_LOG_LEVEL_CRITICAL, "set_idp_list called on something not a" \
+ "LassoProfile object: %p", profile);
+ return;
+ }
+ lasso_assign_gobject(profile->private_data->idp_list, idp_list);
+}
+
/*****************************************************************************/
/* private methods */
/*****************************************************************************/
@@ -891,6 +959,8 @@ instance_init(LassoProfile *profile)
profile->private_data->artifact = NULL;
profile->private_data->artifact_message = NULL;
profile->private_data->signature_hint = LASSO_PROFILE_SIGNATURE_HINT_MAYBE;
+ profile->private_data->message_id = NULL;
+ profile->private_data->idp_list = NULL;
profile->server = NULL;
profile->request = NULL;
diff --git a/lasso/id-ff/profile.h b/lasso/id-ff/profile.h
index 14a37fb..a0cc31b 100644
--- a/lasso/id-ff/profile.h
+++ b/lasso/id-ff/profile.h
@@ -214,6 +214,13 @@ LASSO_EXPORT lasso_error_t lasso_profile_get_signature_status(LassoProfile *prof
LASSO_EXPORT char* lasso_profile_get_issuer(const char *message);
LASSO_EXPORT char* lasso_profile_get_in_response_to(const char *message);
+LASSO_EXPORT char* lasso_profile_get_message_id(LassoProfile *profile);
+LASSO_EXPORT void lasso_profile_set_message_id(LassoProfile *profile, const char *message_id);
+
+LASSO_EXPORT LassoNode* lasso_profile_get_idp_list(LassoProfile *profile);
+LASSO_EXPORT void lasso_profile_set_idp_list(LassoProfile *profile, const LassoNode *idp_list);
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/lasso/id-ff/profileprivate.h b/lasso/id-ff/profileprivate.h
index 5821057..8527ca5 100644
--- a/lasso/id-ff/profileprivate.h
+++ b/lasso/id-ff/profileprivate.h
@@ -38,6 +38,8 @@ struct _LassoProfilePrivate
gboolean dispose_has_run;
LassoProfileSignatureHint signature_hint;
LassoProfileSignatureVerifyHint signature_verify_hint;
+ gchar *message_id;
+ LassoNode *idp_list;
};
void lasso_profile_set_response_status(LassoProfile *profile, const gchar *statusCodeValue);