ID-WSF 1.0 & 2.0: complete lasso-sections.txt, add internal API to access SOAP headers, complete WS-Addressing support
* docs/reference/lasso/lasso-sections.txt: complete documentation of LassoSoapEnvelope and LassoSoapFault with ID-WSF additions. * lasso/id-wsf-2.0/profile.c lasso/id-wsf-2.0/soap_binding.c lasso/id-wsf-2.0/soap_binding.h: add internal function _get_node and _get_header to simplify implementation of accessors for headers. change signature of lasso_soap_envelope_get_message_id and add new function lasso_soap_envelope_get_relates_to. update call points. add a message id when building a SOAP message. * lasso/xml/idwsf_strings.h: add element name for MessageID and RelatesTo WS-Addressing elements. * lasso/id-wsf/authentication.c lasso/id-wsf/data_service.c lasso/id-wsf/discovery.c lasso/id-wsf/wsf_profile.c lasso/id-wsf-2.0/saml2_login.c lasso/xml/disco_description.c: fix path name of header lasso/id-wsf/wsf_utils.h. make all internal include path relatives.
This commit is contained in:
parent
7d786e27bf
commit
1e581e05b7
|
@ -1312,6 +1312,9 @@ LASSO_SAML_SUBJECT_STATEMENT_GET_CLASS
|
|||
LassoSoapFault
|
||||
lasso_soap_fault_new
|
||||
lasso_soap_fault_new_from_message
|
||||
<SUBSECTION SoapBinding>
|
||||
lasso_soap_fault_add_to_detail
|
||||
lasso_soap_fault_get_detail
|
||||
<SUBSECTION Standard>
|
||||
LASSO_SOAP_FAULT
|
||||
LASSO_IS_SOAP_FAULT
|
||||
|
@ -2435,6 +2438,21 @@ LASSO_SOAP_DETAIL_GET_CLASS
|
|||
LassoSoapEnvelope
|
||||
lasso_soap_envelope_new
|
||||
lasso_soap_envelope_new_from_message
|
||||
<SUBSECTION SoapBinding>
|
||||
lasso_soap_envelope_add_action
|
||||
lasso_soap_envelope_add_security_token
|
||||
lasso_soap_envelope_add_to_body
|
||||
lasso_soap_envelope_get_action
|
||||
lasso_soap_envelope_get_body_content
|
||||
lasso_soap_envelope_get_message_id
|
||||
lasso_soap_envelope_get_relates_to
|
||||
lasso_soap_envelope_get_saml2_security_token
|
||||
lasso_soap_envelope_get_sb2_user_interaction_hint
|
||||
lasso_soap_envelope_sb2_get_provider_id
|
||||
lasso_soap_envelope_sb2_get_redirect_request_url
|
||||
lasso_soap_envelope_sb2_get_target_identity_header
|
||||
lasso_soap_envelope_set_sb2_user_interaction_hint
|
||||
lasso_soap_envelope_wssec_get_security_header
|
||||
<SUBSECTION Standard>
|
||||
LASSO_SOAP_ENVELOPE
|
||||
LASSO_IS_SOAP_ENVELOPE
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#include "../utils.h"
|
||||
#include "./idwsf2_helper.h"
|
||||
#include "./soap_binding.h"
|
||||
#include "../id-wsf/utils.h"
|
||||
#include "../id-wsf/wsf_utils.h"
|
||||
#include "../saml-2.0/saml2_helper.h"
|
||||
|
||||
/**
|
||||
|
@ -124,6 +124,7 @@ lasso_idwsf2_profile_build_soap_envelope(const char *refToMessageId, const char
|
|||
LassoSoapHeader *header;
|
||||
LassoSoapBody *body;
|
||||
LassoIdWsf2Sb2Sender *sender;
|
||||
LassoWsAddrAttributedURI *message_id;
|
||||
|
||||
/* Body */
|
||||
body = lasso_soap_body_new();
|
||||
|
@ -141,6 +142,9 @@ lasso_idwsf2_profile_build_soap_envelope(const char *refToMessageId, const char
|
|||
lasso_list_add_gobject(header->Other, sender);
|
||||
}
|
||||
|
||||
message_id = lasso_soap_envelope_get_message_id(envelope, TRUE);
|
||||
message_id->content = lasso_build_unique_id(32);
|
||||
|
||||
if (refToMessageId) {
|
||||
LassoWsAddrAttributedURI *relates_to;
|
||||
relates_to = lasso_wsa_attributed_uri_new_with_string(refToMessageId);
|
||||
|
@ -207,8 +211,9 @@ lasso_idwsf2_profile_init_response(LassoIdWsf2Profile *profile)
|
|||
{
|
||||
char *provider_id = NULL;
|
||||
LassoSoapEnvelope *soap_envelope;
|
||||
char *request_message_id = NULL;
|
||||
int rc = 0;
|
||||
LassoWsAddrAttributedURI *request_message_id;
|
||||
char *request_message_id_content = NULL;
|
||||
|
||||
lasso_bad_param(IDWSF2_PROFILE, profile);
|
||||
|
||||
|
@ -216,8 +221,11 @@ lasso_idwsf2_profile_init_response(LassoIdWsf2Profile *profile)
|
|||
provider_id = profile->parent.server->parent.ProviderID;
|
||||
}
|
||||
request_message_id = lasso_soap_envelope_get_message_id(
|
||||
lasso_idwsf2_profile_get_soap_envelope_request(profile));
|
||||
soap_envelope = lasso_idwsf2_profile_build_soap_envelope(request_message_id, provider_id);
|
||||
lasso_idwsf2_profile_get_soap_envelope_request(profile), FALSE);
|
||||
if (request_message_id) {
|
||||
request_message_id_content = request_message_id->content;
|
||||
}
|
||||
soap_envelope = lasso_idwsf2_profile_build_soap_envelope(request_message_id_content, provider_id);
|
||||
_set_soap_envelope_response(profile, soap_envelope);
|
||||
lasso_release_gobject(profile->parent.response);
|
||||
|
||||
|
@ -304,7 +312,8 @@ lasso_idwsf2_profile_process_request_msg(LassoIdWsf2Profile *wsf2_profile, const
|
|||
{
|
||||
LassoProfile *profile = NULL;
|
||||
LassoSoapEnvelope *envelope = NULL;
|
||||
char *message_id;
|
||||
LassoWsAddrAttributedURI *message_id;
|
||||
char *message_id_content = NULL;
|
||||
char *provider_id;
|
||||
int rc = 0;
|
||||
|
||||
|
@ -336,11 +345,14 @@ lasso_idwsf2_profile_process_request_msg(LassoIdWsf2Profile *wsf2_profile, const
|
|||
|
||||
/* Initialize soap response */
|
||||
message_id = lasso_soap_envelope_get_message_id(
|
||||
_get_soap_envelope_request(wsf2_profile));
|
||||
_get_soap_envelope_request(wsf2_profile), FALSE);
|
||||
if (message_id) {
|
||||
message_id_content = message_id->content;
|
||||
}
|
||||
if (LASSO_IS_SERVER(profile->server)) {
|
||||
provider_id = profile->server->parent.ProviderID;
|
||||
lasso_assign_new_gobject(wsf2_profile->private_data->soap_envelope_response,
|
||||
lasso_idwsf2_profile_build_soap_envelope(message_id, provider_id));
|
||||
lasso_idwsf2_profile_build_soap_envelope(message_id_content, provider_id));
|
||||
}
|
||||
_add_fault_for_rc(wsf2_profile, rc);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "../xml/id-wsf-2.0/disco_security_context.h"
|
||||
#include "../xml/id-wsf-2.0/sec_token.h"
|
||||
#include "../xml/id-wsf-2.0/sbf_framework.h"
|
||||
#include "../id-wsf/utils.h"
|
||||
#include "../id-wsf/wsf_utils.h"
|
||||
#include "../xml/saml-2.0/saml2_attribute.h"
|
||||
#include "../xml/saml-2.0/saml2_attribute_statement.h"
|
||||
#include "../xml/saml-2.0/saml2_attribute_value.h"
|
||||
|
|
|
@ -240,31 +240,90 @@ lasso_soap_envelope_add_to_body(LassoSoapEnvelope *soap_envelope, LassoNode *con
|
|||
lasso_list_add_gobject(soap_envelope->Body->any, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* lasso_soap_envelope_get_message_id:
|
||||
* @soap_envelope: a #LassoSoapEnvelope object
|
||||
*
|
||||
* Return the WS-Addressing header MessageID content.
|
||||
*
|
||||
* Return value:(transfer none)(allow-none): a string or NULL if no message-id header is found.
|
||||
*/
|
||||
char*
|
||||
lasso_soap_envelope_get_message_id(LassoSoapEnvelope *soap_envelope)
|
||||
inline static LassoNode*
|
||||
_get_node(GList **list, GType node_type, const char *node_name, const char *node_namespace,
|
||||
const char *node_prefix, gboolean create)
|
||||
{
|
||||
GList *i;
|
||||
|
||||
if (! LASSO_IS_SOAP_ENVELOPE(soap_envelope) || ! LASSO_IS_SOAP_HEADER(soap_envelope->Header))
|
||||
return NULL;
|
||||
lasso_foreach(i, (*list)) {
|
||||
LassoNode *node = (LassoNode*)i->data;
|
||||
|
||||
lasso_foreach(i, soap_envelope->Header->Other) {
|
||||
if (LASSO_IS_WSA_ATTRIBUTED_URI(i->data) && g_strcmp0(lasso_node_get_name((LassoNode*)i->data),
|
||||
"MessageID")) {
|
||||
return ((LassoWsAddrAttributedURI*)i->data)->content;
|
||||
if (LASSO_IS_NODE(node) &&
|
||||
(! node_type || ( G_IS_OBJECT(node) && G_OBJECT_TYPE(node) == node_type)) &&
|
||||
(! node_name || g_strcmp0(lasso_node_get_name(node), node_name) == 0) &&
|
||||
(! node_namespace ||
|
||||
g_strcmp0(lasso_node_get_namespace(node), node_namespace) == 0)) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
if (create) {
|
||||
LassoNode *node = (LassoNode*)g_object_new(node_type, NULL);
|
||||
if (! node) {
|
||||
return NULL;
|
||||
}
|
||||
if (g_strcmp0(lasso_node_get_name(node), node_name) != 0) {
|
||||
lasso_node_set_custom_nodename(node, node_name);
|
||||
}
|
||||
if (g_strcmp0(lasso_node_get_namespace(node), node_namespace) == 0) {
|
||||
lasso_node_set_custom_namespace(node, node_namespace, node_prefix);
|
||||
}
|
||||
lasso_list_add_new_gobject(*list, node);
|
||||
return node;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LassoNode*
|
||||
_lasso_soap_envelope_get_header(LassoSoapEnvelope *soap_envelope, GType node_type,
|
||||
const char *node_name, const char *node_namespace, const char *node_prefix,
|
||||
gboolean create)
|
||||
{
|
||||
if (! LASSO_IS_SOAP_ENVELOPE(soap_envelope) || !
|
||||
LASSO_IS_SOAP_HEADER(soap_envelope->Header)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _get_node(&soap_envelope->Header->Other, node_type, node_name, node_namespace,
|
||||
node_prefix, create);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* lasso_soap_envelope_get_message_id:
|
||||
* @soap_envelope: a #LassoSoapEnvelope object
|
||||
* @create:(default FALSE): whether to create the node if it is not found
|
||||
*
|
||||
* Return the WS-Addressing header MessageID content.
|
||||
*
|
||||
* Return value:(transfer none): a #LassoWsAddrAttributedURI object or NULL if none is found, and
|
||||
* creation was not allowed.
|
||||
*/
|
||||
LassoWsAddrAttributedURI*
|
||||
lasso_soap_envelope_get_message_id(LassoSoapEnvelope *soap_envelope, gboolean create)
|
||||
{
|
||||
return (LassoWsAddrAttributedURI*)_lasso_soap_envelope_get_header(soap_envelope,
|
||||
LASSO_TYPE_WSA_ATTRIBUTED_URI, LASSO_WSA_ELEMENT_MESSAGE_ID, NULL, NULL,
|
||||
create);
|
||||
}
|
||||
|
||||
/**
|
||||
* lasso_soap_envelope_get_relates_to:
|
||||
* @soap_envelope: a #LassoSoapEnvelope object
|
||||
* @create:(default FALSE): whether to create the node if it is not found
|
||||
*
|
||||
*
|
||||
* Returns the RelatesTo WS-Addressing header, if it exists.
|
||||
*
|
||||
* Return value:(transfer none): a #LassoWsAddrAttributedURI object or NULL if none is found, and creation was not allowed.
|
||||
*/
|
||||
LassoWsAddrRelatesTo*
|
||||
lasso_soap_envelope_get_relates_to(LassoSoapEnvelope *soap_envelope, gboolean create)
|
||||
{
|
||||
return (LassoWsAddrRelatesTo*)_lasso_soap_envelope_get_header(soap_envelope,
|
||||
LASSO_TYPE_WSA_RELATES_TO, NULL, NULL, NULL, create);
|
||||
}
|
||||
|
||||
/**
|
||||
* lasso_soap_envelope_get_body_content:
|
||||
* @soap_envelope: a #LassoSoapEnvelope object
|
||||
|
|
|
@ -34,6 +34,8 @@ extern "C" {
|
|||
#include "../xml/soap-1.1/soap_fault.h"
|
||||
#include "../xml/id-wsf-2.0/sb2_target_identity.h"
|
||||
#include "../xml/ws/wsse_security_header.h"
|
||||
#include "../xml/ws/wsa_attributed_uri.h"
|
||||
#include "../xml/ws/wsa_relates_to.h"
|
||||
#include "../xml/saml-2.0/saml2_assertion.h"
|
||||
|
||||
typedef enum {
|
||||
|
@ -65,7 +67,11 @@ LASSO_EXPORT const char* lasso_soap_envelope_get_action(LassoSoapEnvelope *soap_
|
|||
LASSO_EXPORT void lasso_soap_envelope_add_to_body(LassoSoapEnvelope *soap_envelope,
|
||||
LassoNode *content);
|
||||
|
||||
LASSO_EXPORT char* lasso_soap_envelope_get_message_id(LassoSoapEnvelope *soap_envelope);
|
||||
LASSO_EXPORT LassoWsAddrAttributedURI *lasso_soap_envelope_get_message_id(
|
||||
LassoSoapEnvelope *soap_envelope, gboolean create);
|
||||
|
||||
LASSO_EXPORT LassoWsAddrRelatesTo *lasso_soap_envelope_get_relates_to(LassoSoapEnvelope *envelope,
|
||||
gboolean create);
|
||||
|
||||
LASSO_EXPORT GList* lasso_soap_envelope_get_body_content(LassoSoapEnvelope *soap_envelope);
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "./authentication.h"
|
||||
#include "../xml/private.h"
|
||||
#include "authentication.h"
|
||||
#include "../xml/sa_sasl_request.h"
|
||||
#include "../xml/sa_sasl_response.h"
|
||||
#include "../xml/soap_binding_correlation.h"
|
||||
|
|
|
@ -61,8 +61,8 @@
|
|||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
|
||||
#include "discovery.h"
|
||||
#include "data_service.h"
|
||||
#include "./discovery.h"
|
||||
#include "./data_service.h"
|
||||
#include "../xml/dst_query.h"
|
||||
#include "../xml/dst_query_response.h"
|
||||
#include "../xml/dst_modify.h"
|
||||
|
|
|
@ -81,9 +81,9 @@
|
|||
#include "../id-ff/providerprivate.h"
|
||||
#include "../id-ff/sessionprivate.h"
|
||||
|
||||
#include "id_wsf.h"
|
||||
#include "wsf_profile_private.h"
|
||||
#include "utils.h"
|
||||
#include "./id_wsf.h"
|
||||
#include "./wsf_profile_private.h"
|
||||
#include "./wsf_utils.h"
|
||||
#include "../utils.h"
|
||||
|
||||
struct _LassoDiscoveryPrivate
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "./wsf_profile.h"
|
||||
#include "./wsf_profile_private.h"
|
||||
#include "./discovery.h"
|
||||
#include "./utils.h"
|
||||
#include "./wsf_utils.h"
|
||||
#include "../xml/disco_modify.h"
|
||||
#include "../xml/soap-1.1/soap_fault.h"
|
||||
#include "../xml/soap_binding_correlation.h"
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
#include "private.h"
|
||||
#include "disco_description.h"
|
||||
#include "../id-wsf/utils.h"
|
||||
#include "..//utils.h"
|
||||
#include "../id-wsf/wsf_utils.h"
|
||||
#include "../utils.h"
|
||||
|
||||
/**
|
||||
* SECTION:disco_description
|
||||
|
|
|
@ -655,6 +655,20 @@
|
|||
*/
|
||||
#define LASSO_WSA_PREFIX "wsa"
|
||||
|
||||
/**
|
||||
* LASSO_WSA_ELEMENT_MESSAGE_ID:
|
||||
*
|
||||
* Name of the element representing SOAP MessageID in the WS-Addressing specification.
|
||||
*/
|
||||
#define LASSO_WSA_ELEMENT_MESSAGE_ID "MessageID"
|
||||
/**
|
||||
* LASSO_WSA_ELEMENT_RELATES_TO:
|
||||
*
|
||||
* Name of the element representing SOAP messages inter-relationships in the WS-Addressing
|
||||
* specification.
|
||||
*/
|
||||
#define LASSO_WSA_ELEMENT_RELATES_TO "RelatesTo"
|
||||
|
||||
/* WS-Utility */
|
||||
/**
|
||||
* LASSO_WSU_HREF:
|
||||
|
|
Loading…
Reference in New Issue