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
This commit is contained in:
John Dennis 2015-05-28 13:39:20 -04:00 committed by Benjamin Dauvergne
parent bdecdc248c
commit 43bcc8cddf
3 changed files with 79 additions and 0 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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);