All: Rework include files handling, separated ID-WSF code from SAML2/ID-FF code

* nearly all C files: change includes for relative paths.
 * lasso/id-wsf/id_wsf.h, lasso/id-wsf-2.0/id_wsf_2.h: add top level
   public include files for ID-WSF 1.0 and ID-WSF 2.0.
 * lasso/id-ff/server.*, lasso/id-ff/session.*, lasso/id-ff/identity.*:
   remove most of the code related to ID-WSF and push into
   lasso/id-wsf/id_ff_extensions.* and lasso/id-wsf-2.0/identity.c,
   lasso/id-wsf-2.0/server.c, lasso/id-wsf-2.0/session.c.
 * lasso/id-wsf-2.0/saml2_login.c,
   lasso/id-wsf-2.0/saml2_login_private.h: same change but for ID-WSF
   2.0 support in SAML2 SSO profile.
This commit is contained in:
Benjamin Dauvergne 2009-08-26 15:14:32 +00:00
parent b763241411
commit 7231771856
491 changed files with 2146 additions and 1699 deletions

View File

@ -23,8 +23,8 @@
*/
#include <glib/gstrfuncs.h>
#include <lasso/errors.h>
#include <lasso/xml/xml.h>
#include "errors.h"
#include "xml/xml.h"
/* WARNING!!!: This is a generated file do not modify it, add new error message
* a comments inside errors.h */

View File

@ -23,8 +23,8 @@
*/
#include <glib/gstrfuncs.h>
#include <lasso/errors.h>
#include <lasso/xml/xml.h>
#include "errors.h"
#include "xml/xml.h"
/* WARNING!!!: This is a generated file do not modify it, add new error message
* a comments inside errors.h */

View File

@ -29,13 +29,13 @@
**/
#include "../xml/private.h"
#include <lasso/id-ff/defederation.h>
#include "defederation.h"
#include <lasso/id-ff/providerprivate.h>
#include <lasso/id-ff/sessionprivate.h>
#include <lasso/id-ff/identityprivate.h>
#include <lasso/id-ff/profileprivate.h>
#include <lasso/id-ff/serverprivate.h>
#include "providerprivate.h"
#include "sessionprivate.h"
#include "identityprivate.h"
#include "profileprivate.h"
#include "serverprivate.h"
#include "../xml/private.h"
#include "../utils.h"

View File

@ -29,8 +29,8 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/profile.h>
#include <lasso/xml/lib_federation_termination_notification.h>
#include "profile.h"
#include "../xml/lib_federation_termination_notification.h"
#define LASSO_TYPE_DEFEDERATION (lasso_defederation_get_type())
#define LASSO_DEFEDERATION(obj) \

View File

@ -29,10 +29,10 @@
**/
#include "../xml/private.h"
#include <lasso/id-ff/federation.h>
#include <lasso/id-ff/provider.h>
#include "federation.h"
#include "provider.h"
#include <lasso/xml/saml-2.0/saml2_name_id.h>
#include "../xml/saml-2.0/saml2_name_id.h"
struct _LassoFederationPrivate
{

View File

@ -29,8 +29,8 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/xml/saml_name_identifier.h>
#include "../xml/xml.h"
#include "../xml/saml_name_identifier.h"
#define LASSO_TYPE_FEDERATION (lasso_federation_get_type())
#define LASSO_FEDERATION(obj) \

View File

@ -31,24 +31,13 @@
#include "../xml/private.h"
#include <config.h>
#include "../utils.h"
#include <lasso/id-ff/identity.h>
#include "identity.h"
#ifdef LASSO_WSF_ENABLED
#include <lasso/id-wsf/identity.h>
#include <lasso/id-wsf-2.0/identity.h>
#include "../id-wsf/id_ff_extensions.h"
#endif
#include <lasso/id-ff/identityprivate.h>
struct _LassoIdentityPrivate
{
gboolean dispose_has_run;
#ifdef LASSO_WSF_ENABLED
guint last_entry_id;
GHashTable *resource_offerings_map; /* of LassoDiscoResourceOffering */
GList *svcMDID; /* of char* */
#endif
};
#include "identityprivate.h"
/*****************************************************************************/
/* public methods */
@ -136,152 +125,6 @@ lasso_identity_destroy(LassoIdentity *identity)
lasso_node_destroy(LASSO_NODE(identity));
}
#ifdef LASSO_WSF_ENABLED
/**
* lasso_identity_add_resource_offering:
* @identity: a #LassoIdentity object
* @offering: a #LassoDiscoResourceOffering object to add
*
* Add a new offering to the identity object to be retrieved later by
* lasso_identity_get_offerings() or lasso_identity_get_resource_offering().
* It also allocate an entryId identifier for the offering, look into
* offering->entryID to get it after this call.
*
* Return value: Always 0, there should not be any error (if memory is not exhausted).
*/
gint
lasso_identity_add_resource_offering(LassoIdentity *identity,
LassoDiscoResourceOffering *offering)
{
char entry_id_s[20];
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(LASSO_IS_DISCO_RESOURCE_OFFERING(offering),
LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
do {
g_snprintf(entry_id_s, 18, "%d", identity->private_data->last_entry_id);
identity->private_data->last_entry_id++;
} while (g_hash_table_lookup(identity->private_data->resource_offerings_map, entry_id_s));
lasso_assign_string(offering->entryID, entry_id_s);
g_hash_table_insert(identity->private_data->resource_offerings_map,
g_strdup(offering->entryID), g_object_ref(offering));
identity->is_dirty = TRUE;
return 0;
}
/**
* lasso_identity_remove_resource_offering:
* @identity: a #LassoIdentity
* @entryID: the resource offering entry ID
*
* Remove resource offering about identity with @entryID
*
* Return value: TRUE on success; FALSE if the offering was not found.
**/
gboolean
lasso_identity_remove_resource_offering(LassoIdentity *identity, const char *entryID)
{
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), FALSE);
g_return_val_if_fail(entryID != NULL, LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
if (g_hash_table_remove(identity->private_data->resource_offerings_map, entryID)) {
identity->is_dirty = TRUE;
return TRUE;
} else {
return FALSE;
}
}
/* Context type for the callback add_matching_resource_offering_to_list */
struct HelperStruct {
GList *list;
const char *service_type;
};
/*
* Helper function for lasso_identity_get_offerings, match them with a service
* type string */
static
void add_matching_resource_offering_to_list(G_GNUC_UNUSED char *name, LassoDiscoResourceOffering *offering,
struct HelperStruct *ctx)
{
if (ctx->service_type == NULL ||
( offering->ServiceInstance != NULL &&
offering->ServiceInstance->ServiceType != NULL &&
strcmp(offering->ServiceInstance->ServiceType, ctx->service_type) == 0)) {
lasso_list_add_gobject(ctx->list, offering);
}
}
/**
* lasso_identity_get_offerings:
* @identity: a #LassoIdentity
* @service_type: a char* string representing the type of service we are looking for
*
* Returns a list of #LassoDiscoResourceOffering associated to this service type.
*
* Return value: a newly allocated list of #LassoDiscoResourceOffering
*/
GList*
lasso_identity_get_offerings(LassoIdentity *identity, const char *service_type)
{
struct HelperStruct ctx = { NULL, service_type };
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), NULL);
g_hash_table_foreach(identity->private_data->resource_offerings_map,
(GHFunc)add_matching_resource_offering_to_list, &ctx);
return ctx.list;
}
/**
* lasso_identity_resource_offering:
* @identity: a #LassoIdentity
* @entryID: the entryID of the researched #LassoDiscoResourceOffering
*
* Lookup a #LassoDiscoResourceOffering corresponding to entryID, entryID is
* usually allocated by lasso_identity_add_resource_offering() inside
* offering->entryID.
*
* Return value: a #LassoDiscoResourceOffering, your must ref it if you intend
* to keep it around.
*/
LassoDiscoResourceOffering*
lasso_identity_get_resource_offering(LassoIdentity *identity, const char *entryID)
{
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), NULL);
g_return_val_if_fail(entryID != NULL, NULL);
return g_hash_table_lookup(identity->private_data->resource_offerings_map, entryID);
}
gint
lasso_identity_add_svc_md_id(LassoIdentity *identity, gchar *svcMDID)
{
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(svcMDID != NULL, LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
identity->private_data->svcMDID = g_list_append(
identity->private_data->svcMDID, g_strdup(svcMDID));
identity->is_dirty = TRUE;
return 0;
}
GList*
lasso_identity_get_svc_md_ids(LassoIdentity *identity)
{
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), NULL);
return identity->private_data->svcMDID;
}
#endif
/*****************************************************************************/
/* private methods */

View File

@ -29,8 +29,8 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/id-ff/federation.h>
#include "../xml/xml.h"
#include "federation.h"
#define LASSO_TYPE_IDENTITY (lasso_identity_get_type())
#define LASSO_IDENTITY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_IDENTITY, LassoIdentity))

View File

@ -29,6 +29,18 @@
extern "C" {
#endif /* __cplusplus */
#include "config.h"
struct _LassoIdentityPrivate
{
gboolean dispose_has_run;
#ifdef LASSO_WSF_ENABLED
guint last_entry_id;
GHashTable *resource_offerings_map; /* of LassoDiscoResourceOffering */
GList *svcMDID; /* of char* */
#endif
};
gint lasso_identity_add_federation(LassoIdentity *identity, LassoFederation *federation);
gint lasso_identity_remove_federation(LassoIdentity *identity, const char *providerID);

View File

@ -32,8 +32,8 @@
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <lasso/id-ff/lecp.h>
#include <lasso/id-ff/profileprivate.h>
#include "lecp.h"
#include "profileprivate.h"
#include "../utils.h"
#include "../utils.h"

View File

@ -29,12 +29,12 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include "../xml/xml.h"
#include <lasso/xml/lib_authn_request_envelope.h>
#include <lasso/xml/lib_authn_response_envelope.h>
#include "../xml/lib_authn_request_envelope.h"
#include "../xml/lib_authn_response_envelope.h"
#include <lasso/id-ff/login.h>
#include "login.h"
#define LASSO_TYPE_LECP (lasso_lecp_get_type())
#define LASSO_LECP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LECP, LassoLecp))

View File

@ -143,38 +143,37 @@
* </example>
*/
#include "../xml/private.h"
#include <xmlsec/base64.h>
#include <config.h>
#include <lasso/xml/lib_authentication_statement.h>
#include <lasso/xml/lib_subject.h>
#include <lasso/xml/saml_advice.h>
#include <lasso/xml/saml_attribute.h>
#include <lasso/xml/saml_attribute_value.h>
#include <lasso/xml/saml_audience_restriction_condition.h>
#include <lasso/xml/saml_conditions.h>
#include <lasso/xml/samlp_response.h>
#include <lasso/xml/saml-2.0/saml2_encrypted_element.h>
#ifdef LASSO_WSF_ENABLED
#include <lasso/xml/disco_description.h>
#include <lasso/xml/disco_resource_offering.h>
#include <lasso/xml/disco_service_instance.h>
#endif
#include <lasso/id-ff/login.h>
#include <lasso/id-ff/provider.h>
#include "./profileprivate.h"
#include "./providerprivate.h"
#include "./serverprivate.h"
#include "./sessionprivate.h"
#include "./identityprivate.h"
#include "./loginprivate.h"
#include "../saml-2.0/loginprivate.h"
#include "lasso_config.h"
#include "../utils.h"
#include "../debug.h"
#include "login.h"
#include "provider.h"
#include "../xml/private.h"
#include "../xml/lib_authentication_statement.h"
#include "../xml/lib_subject.h"
#include "../xml/saml_advice.h"
#include "../xml/saml_attribute.h"
#include "../xml/saml_attribute_value.h"
#include "../xml/saml_audience_restriction_condition.h"
#include "../xml/saml_conditions.h"
#include "../xml/samlp_response.h"
#include "../xml/saml-2.0/saml2_encrypted_element.h"
#include "profileprivate.h"
#include "providerprivate.h"
#include "serverprivate.h"
#include "sessionprivate.h"
#include "identityprivate.h"
#include "loginprivate.h"
#include "../saml-2.0/loginprivate.h"
#ifdef LASSO_WSF_ENABLED
#include "../id-wsf/id_ff_extensions_private.h"
#endif
static void lasso_login_build_assertion_artifact(LassoLogin *login);
@ -184,52 +183,6 @@ static void lasso_login_build_assertion_artifact(LassoLogin *login);
/*****************************************************************************/
#ifdef LASSO_WSF_ENABLED
/**
* lasso_login_assertion_add_discovery:
* @login: a #LassoLogin
* @assertion:
*
* Adds AttributeStatement and ResourceOffering attributes to assertion if
* there is a discovery service.
**/
static void
lasso_login_assertion_add_discovery(LassoLogin *login, LassoSamlAssertion *assertion)
{
LassoProfile *profile = LASSO_PROFILE(login);
LassoDiscoResourceOffering *resourceOffering;
LassoDiscoServiceInstance *serviceInstance, *newServiceInstance;
LassoSamlAttributeStatement *attributeStatement;
LassoSamlAttribute *attribute;
LassoSamlAttributeValue *attributeValue;
serviceInstance = lasso_server_get_service(profile->server, LASSO_DISCO_HREF);
if (LASSO_IS_DISCO_SERVICE_INSTANCE(serviceInstance) &&
login->private_data->resourceId) {
newServiceInstance = lasso_disco_service_instance_copy(serviceInstance);
resourceOffering = lasso_disco_resource_offering_new(newServiceInstance);
lasso_release_gobject(newServiceInstance);
lasso_assign_gobject(resourceOffering->ResourceID, login->private_data->resourceId);
attributeValue = lasso_saml_attribute_value_new();
lasso_list_add_new_gobject(attributeValue->any, resourceOffering);
attribute = lasso_saml_attribute_new();
lasso_assign_string(attribute->attributeName, "DiscoveryResourceOffering");
lasso_assign_string(attribute->attributeNameSpace, LASSO_DISCO_HREF);
lasso_list_add_new_gobject(attribute->AttributeValue, attributeValue);
attributeStatement = lasso_saml_attribute_statement_new();
lasso_list_add_new_gobject(attributeStatement->Attribute, attribute);
lasso_assign_new_gobject(assertion->AttributeStatement, attributeStatement);
/* FIXME: Add CredentialsRef and saml:Advice Assertions */
}
}
#endif
/**
* lasso_login_build_assertion:
@ -2018,57 +1971,6 @@ lasso_login_process_response_msg(LassoLogin *login, gchar *response_msg)
}
#ifdef LASSO_WSF_ENABLED
/**
* lasso_login_set_encryptedResourceId:
* @login: a #LassoLogin
* @encryptedResourceId:
*
* ...
*
* Return value: 0 on success; or a negative value otherwise.
**/
int
lasso_login_set_encryptedResourceId(LassoLogin *login,
LassoDiscoEncryptedResourceID *encryptedResourceId)
{
g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(LASSO_IS_DISCO_ENCRYPTED_RESOURCE_ID(encryptedResourceId),
LASSO_PARAM_ERROR_INVALID_VALUE);
lasso_assign_gobject(login->private_data->encryptedResourceId, encryptedResourceId);
return 0;
}
#endif
#ifdef LASSO_WSF_ENABLED
/**
* lasso_login_set_resourceId:
* @login: a #LassoLogin
* @content:
*
* ...
*
* Return value: 0 on success; or a negative value otherwise.
**/
int
lasso_login_set_resourceId(LassoLogin *login, const char *content)
{
g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(content != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
lasso_assign_new_gobject(login->private_data->resourceId, lasso_disco_resource_id_new(content));
return 0;
}
#else
int
lasso_login_set_resourceId(G_GNUC_UNUSED LassoLogin *login, G_GNUC_UNUSED const char *content)
{
return LASSO_ERROR_UNIMPLEMENTED;
}
#endif
/*****************************************************************************/
/* private methods */

View File

@ -30,21 +30,13 @@ extern "C" {
#endif /* __cplusplus */
#include <lasso/lasso_config.h>
#ifdef LASSO_WSF_ENABLED
#include <lasso/xml/disco_encrypted_resource_id.h>
#else
typedef void LassoDiscoEncryptedResourceID;
typedef void LassoDiscoResourceID;
#endif
#include "../xml/lib_authn_request.h"
#include "../xml/lib_authn_response.h"
#include "../xml/samlp_request.h"
#include "../xml/samlp_response.h"
#include <lasso/xml/lib_authn_request.h>
#include <lasso/xml/lib_authn_response.h>
#include <lasso/xml/samlp_request.h>
#include <lasso/xml/samlp_response.h>
#include <lasso/id-ff/profile.h>
#include "profile.h"
#define LASSO_TYPE_LOGIN (lasso_login_get_type())
#define LASSO_LOGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LOGIN, LassoLogin))
@ -146,11 +138,6 @@ LASSO_EXPORT gint lasso_login_process_authn_response_msg(LassoLogin *login,
LASSO_EXPORT gint lasso_login_process_request_msg(LassoLogin *login, gchar *request_msg);
LASSO_EXPORT gint lasso_login_process_response_msg(LassoLogin *login, gchar *response_msg);
LASSO_EXPORT int lasso_login_set_encryptedResourceId(
LassoLogin *login, LassoDiscoEncryptedResourceID *encryptedResourceId);
LASSO_EXPORT int lasso_login_set_resourceId(LassoLogin *login, const char *content);
LASSO_EXPORT int lasso_login_validate_request_msg(LassoLogin *login,
gboolean authentication_result, gboolean is_consent_obtained);

View File

@ -30,17 +30,14 @@ extern "C" {
#endif /* __cplusplus */
#include <config.h>
#include <lasso/xml/saml-2.0/saml2_assertion.h>
#include "config.h"
#include "../xml/saml-2.0/saml2_assertion.h"
#ifdef LASSO_WSF_ENABLED
#include <lasso/xml/disco_description.h>
#include <lasso/xml/disco_resource_offering.h>
#include <lasso/xml/disco_service_instance.h>
#include "../xml/disco_resource_id.h"
#include "../xml/disco_encrypted_resource_id.h"
#endif
struct _LassoLoginPrivate
{
char *soap_request_msg;

View File

@ -29,16 +29,16 @@
*/
#include "../xml/private.h"
#include <lasso/xml/lib_authentication_statement.h>
#include "../xml/lib_authentication_statement.h"
#include <lasso/id-ff/logout.h>
#include <lasso/id-ff/logoutprivate.h>
#include "logout.h"
#include "logoutprivate.h"
#include <lasso/id-ff/profileprivate.h>
#include <lasso/id-ff/providerprivate.h>
#include <lasso/id-ff/sessionprivate.h>
#include "profileprivate.h"
#include "providerprivate.h"
#include "sessionprivate.h"
#include <lasso/saml-2.0/logoutprivate.h>
#include "../saml-2.0/logoutprivate.h"
#include "../utils.h"
static void check_soap_support(gchar *key, LassoProvider *provider, LassoProfile *profile);

View File

@ -29,9 +29,9 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/profile.h>
#include <lasso/xml/lib_logout_request.h>
#include <lasso/xml/lib_logout_response.h>
#include "profile.h"
#include "../xml/lib_logout_request.h"
#include "../xml/lib_logout_response.h"
#define LASSO_TYPE_LOGOUT (lasso_logout_get_type())
#define LASSO_LOGOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_LOGOUT, LassoLogout))

View File

@ -29,10 +29,10 @@
**/
#include "../xml/private.h"
#include <lasso/id-ff/name_identifier_mapping.h>
#include "name_identifier_mapping.h"
#include <lasso/id-ff/profileprivate.h>
#include <lasso/id-ff/providerprivate.h>
#include "profileprivate.h"
#include "providerprivate.h"
/*****************************************************************************/
/* public methods */

View File

@ -29,10 +29,10 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/profile.h>
#include "profile.h"
#include <lasso/xml/lib_name_identifier_mapping_request.h>
#include <lasso/xml/lib_name_identifier_mapping_response.h>
#include "../xml/lib_name_identifier_mapping_request.h"
#include "../xml/lib_name_identifier_mapping_response.h"
#define LASSO_TYPE_NAME_IDENTIFIER_MAPPING (lasso_name_identifier_mapping_get_type())
#define LASSO_NAME_IDENTIFIER_MAPPING(obj) \

View File

@ -29,9 +29,9 @@
**/
#include "../xml/private.h"
#include <lasso/id-ff/name_registration.h>
#include <lasso/id-ff/profileprivate.h>
#include <lasso/id-ff/providerprivate.h>
#include "name_registration.h"
#include "profileprivate.h"
#include "providerprivate.h"
#include "../utils.h"
/*****************************************************************************/

View File

@ -29,10 +29,10 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/profile.h>
#include "profile.h"
#include <lasso/xml/lib_register_name_identifier_request.h>
#include <lasso/xml/lib_register_name_identifier_response.h>
#include "../xml/lib_register_name_identifier_request.h"
#include "../xml/lib_register_name_identifier_response.h"
#define LASSO_TYPE_NAME_REGISTRATION (lasso_name_registration_get_type())
#define LASSO_NAME_REGISTRATION(obj) \

View File

@ -32,17 +32,17 @@
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <lasso/xml/samlp_response.h>
#include <lasso/xml/samlp_request.h>
#include <lasso/xml/lib_authn_response.h>
#include <lasso/xml/lib_status_response.h>
#include "../xml/samlp_response.h"
#include "../xml/samlp_request.h"
#include "../xml/lib_authn_response.h"
#include "../xml/lib_status_response.h"
#include <lasso/id-ff/profile.h>
#include <lasso/id-ff/profileprivate.h>
#include <lasso/id-ff/providerprivate.h>
#include "profile.h"
#include "profileprivate.h"
#include "providerprivate.h"
#include "./sessionprivate.h"
#include <lasso/saml-2.0/profileprivate.h>
#include "../saml-2.0/profileprivate.h"
#include "../utils.h"
#include "../debug.h"

View File

@ -30,12 +30,12 @@ extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/identity.h>
#include <lasso/id-ff/server.h>
#include <lasso/id-ff/session.h>
#include "identity.h"
#include "server.h"
#include "session.h"
#include <lasso/xml/samlp_request_abstract.h>
#include <lasso/xml/samlp_response_abstract.h>
#include "../xml/samlp_request_abstract.h"
#include "../xml/samlp_response_abstract.h"
#define LASSO_TYPE_PROFILE (lasso_profile_get_type())
#define LASSO_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_PROFILE, LassoProfile))

View File

@ -30,9 +30,9 @@ extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/profile.h>
#include "profile.h"
#include <lasso/xml/soap_envelope.h>
#include "../xml/soap_envelope.h"
struct _LassoProfilePrivate
{

View File

@ -39,10 +39,10 @@
#include <xmlsec/xmltree.h>
#include <xmlsec/templates.h>
#include <lasso/id-ff/provider.h>
#include <lasso/id-ff/providerprivate.h>
#include "provider.h"
#include "providerprivate.h"
#include <lasso/saml-2.0/providerprivate.h>
#include "../saml-2.0/providerprivate.h"
#include <unistd.h>
#include "../utils.h"
#include "../debug.h"

View File

@ -29,8 +29,8 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/xml/xml_enc.h>
#include "../xml/xml.h"
#include "../xml/xml_enc.h"
#define LASSO_TYPE_PROVIDER (lasso_provider_get_type())
#define LASSO_PROVIDER(obj) \

View File

@ -34,20 +34,16 @@
#include <xmlsec/base64.h>
#include <config.h>
#include <lasso/id-ff/server.h>
#include <lasso/id-ff/providerprivate.h>
#include <lasso/id-ff/serverprivate.h>
#include <lasso/saml-2.0/serverprivate.h>
#ifdef LASSO_WSF_ENABLED
#include <lasso/id-wsf-2.0/server.h>
#include <lasso/xml/id-wsf-2.0/disco_service_context.h>
#endif
#include "server.h"
#include "providerprivate.h"
#include "serverprivate.h"
#include "../saml-2.0/serverprivate.h"
#include "../utils.h"
#include "../debug.h"
#ifdef LASSO_WSF_ENABLED
#include "../id-wsf/id_ff_extensions_private.h"
#include "../id-wsf-2.0/serverprivate.h"
#endif
/*****************************************************************************/
/* public methods */
@ -127,136 +123,6 @@ lasso_server_add_provider_from_buffer(LassoServer *server, LassoProviderRole rol
public_key, ca_cert_chain, lasso_provider_new_from_buffer);
}
#ifdef LASSO_WSF_ENABLED
/**
* lasso_server_add_service:
* @server: a #LassoServer
* @service: a #LassoNode object implementing representing a service endpoint.
*
* Add a service to the registry of service of this #LassoServer object.
*
* Return value: 0 on success; a negative value if an error occured.
**/
gint
lasso_server_add_service(LassoServer *server, LassoNode *service)
{
g_return_val_if_fail(LASSO_IS_SERVER(server), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(service != NULL, LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
if (LASSO_IS_DISCO_SERVICE_INSTANCE(service)) {
g_hash_table_insert(server->services,
g_strdup(LASSO_DISCO_SERVICE_INSTANCE(service)->ServiceType),
g_object_ref(service));
} else if (LASSO_IS_IDWSF2_DISCO_SVC_METADATA(service)) {
return lasso_server_add_svc_metadata(server,
LASSO_IDWSF2_DISCO_SVC_METADATA(service));
} else {
return LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ;
}
return 0;
}
#else
gint
lasso_server_add_service(G_GNUC_UNUSED LassoServer *server, G_GNUC_UNUSED LassoNode *service)
{
return LASSO_ERROR_UNIMPLEMENTED;
}
#endif
/**
* lasso_server_add_service_from_dump:
* @server: a #LassoServer
* @dump: the XML dump of a #LassoNode representing a service endpoint.
*
* An utility function that parse a #LassoNode dump an try to add it as a
* service using lasso_server_add_service.
*
* Return value: 0 if succesfull, LASSO_PARAM_ERROR_BAD_TYPE_OF_NULL_OBJECT if
* said dump is not a #LassoNode or is not of the righ type,
* LASSO_PARAM_ERROR_INVALID_VALUE if dump is NULL.
**/
gint
lasso_server_add_service_from_dump(LassoServer *server, const gchar *dump)
{
LassoNode *node;
gint return_code;
g_return_val_if_fail(dump != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
node = lasso_node_new_from_dump(dump);
return_code = lasso_server_add_service(server, node);
g_object_unref(node);
return return_code;
}
#ifdef LASSO_WSF_ENABLED
gint
lasso_server_add_svc_metadata(LassoServer *server, LassoIdWsf2DiscoSvcMetadata *metadata)
{
g_return_val_if_fail(LASSO_IS_SERVER(server), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(LASSO_IS_IDWSF2_DISCO_SVC_METADATA(metadata),
LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
server->private_data->svc_metadatas = g_list_append(
server->private_data->svc_metadatas, g_object_ref(metadata));
return 0;
}
const GList *
lasso_server_get_svc_metadatas(LassoServer *server)
{
g_return_val_if_fail(LASSO_IS_SERVER(server), NULL);
return server->private_data->svc_metadatas;
}
/* XXX: return value must be freed by caller */
GList *
lasso_server_get_svc_metadatas_with_id_and_type(LassoServer *server, GList *svcMDIDs,
const gchar *service_type)
{
gchar *svcMDID;
LassoIdWsf2DiscoSvcMetadata *md;
GList *result = NULL;
GList *i;
GList *j;
g_return_val_if_fail(LASSO_IS_SERVER(server), NULL);
g_return_val_if_fail(service_type != NULL, NULL);
for (i = g_list_first(server->private_data->svc_metadatas); i != NULL; i = g_list_next(i)) {
md = LASSO_IDWSF2_DISCO_SVC_METADATA(i->data);
/* FIXME: this assumes there is one and only one service
* context, and service type, this should be fixed to iterate
* properly on the GList */
if (md->ServiceContext == NULL || strcmp((char*)(LASSO_IDWSF2_DISCO_SERVICE_CONTEXT(
md->ServiceContext->data)->ServiceType)->data, service_type) != 0) {
continue;
}
if (svcMDIDs == NULL) {
/* If no svcMDID is given, return all the metadatas with given */
/* service type */
result = g_list_append(result, g_object_ref(md));
} else {
for (j = g_list_first(svcMDIDs); j != NULL; j = g_list_next(j)) {
svcMDID = (gchar *)(j->data);
if (strcmp(svcMDID, md->svcMDID) == 0) {
result = g_list_append(result, g_object_ref(md));
}
}
}
}
return result;
}
#endif
/**
* lasso_server_destroy:
@ -354,19 +220,6 @@ add_provider_childnode(G_GNUC_UNUSED gchar *key, LassoProvider *value, xmlNode *
xmlAddChild(xmlnode, lasso_node_get_xmlNode(LASSO_NODE(value), TRUE));
}
#ifdef LASSO_WSF_ENABLED
static void
add_service_childnode(G_GNUC_UNUSED gchar *key, LassoNode *value, xmlNode *xmlnode)
{
xmlAddChild(xmlnode, lasso_node_get_xmlNode(LASSO_NODE(value), TRUE));
}
static void
add_childnode_from_list(LassoNode *value, xmlNode *xmlnode)
{
xmlAddChild(xmlnode, lasso_node_get_xmlNode(LASSO_NODE(value), TRUE));
}
#endif
static xmlNode*
get_xmlNode(LassoNode *node, gboolean lasso_dump)
@ -389,21 +242,8 @@ get_xmlNode(LassoNode *node, gboolean lasso_dump)
}
#ifdef LASSO_WSF_ENABLED
/* Services */
if (g_hash_table_size(server->services)) {
xmlNode *t;
t = xmlNewTextChild(xmlnode, NULL, (xmlChar*)"Services", NULL);
g_hash_table_foreach(server->services,
(GHFunc)add_service_childnode, t);
}
/* Service Metadatas (SvcMD) */
if (server->private_data->svc_metadatas != NULL) {
xmlNode *t;
t = xmlNewTextChild(xmlnode, NULL, (xmlChar*)"SvcMDs", NULL);
g_list_foreach(server->private_data->svc_metadatas,
(GFunc)add_childnode_from_list, t);
}
lasso_server_dump_id_wsf_services(server, xmlnode);
lasso_server_dump_id_wsf20_svcmds(server, xmlnode);
#endif
xmlCleanNs(xmlnode);
@ -464,36 +304,8 @@ init_from_xml(LassoNode *node, xmlNode *xmlnode)
}
#ifdef LASSO_WSF_ENABLED
/* Services */
if (strcmp((char*)t->name, "Services") == 0) {
while (t2) {
LassoDiscoServiceInstance *s;
if (t2->type != XML_ELEMENT_NODE) {
t2 = t2->next;
continue;
}
s = g_object_new(LASSO_TYPE_DISCO_SERVICE_INSTANCE, NULL);
LASSO_NODE_GET_CLASS(s)->init_from_xml(LASSO_NODE(s), t2);
g_hash_table_insert(server->services, g_strdup(s->ServiceType), s);
t2 = t2->next;
}
}
/* Service Metadatas (SvcMD) */
if (strcmp((char*)t->name, "SvcMDs") == 0) {
while (t2) {
LassoIdWsf2DiscoSvcMetadata *svcMD;
if (t2->type != XML_ELEMENT_NODE) {
t2 = t2->next;
continue;
}
svcMD = lasso_idwsf2_disco_svc_metadata_new();
LASSO_NODE_GET_CLASS(svcMD)->init_from_xml(LASSO_NODE(svcMD), t2);
server->private_data->svc_metadatas = g_list_append(
server->private_data->svc_metadatas, svcMD);
t2 = t2->next;
}
}
lasso_server_init_id_wsf_services(server, t);
lasso_server_init_id_wsf20_svcmds(server, t);
#endif
t = t->next;
@ -549,24 +361,6 @@ lasso_server_get_provider(LassoServer *server, const gchar *providerID)
}
/**
* lasso_server_get_service:
* @server: a #LassoServer
* @serviceType:
*
* ...
*
* Return value: the #LassoDiscoServiceInstance, NULL if it was not found.
* The #LassoDiscoServiceInstance is owned by Lasso and should not be
* freed.
**/
LassoDiscoServiceInstance*
lasso_server_get_service(LassoServer *server, const gchar *serviceType)
{
return g_hash_table_lookup(server->services, serviceType);
}
static gboolean
get_providerID_with_hash(gchar *key, G_GNUC_UNUSED gpointer value, char **providerID)
{

View File

@ -29,16 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/lasso_config.h>
#ifdef LASSO_WSF_ENABLED
#include <lasso/xml/disco_service_instance.h>
#else
typedef void LassoDiscoServiceInstance;
#endif
#include <lasso/id-ff/provider.h>
#include "provider.h"
#define LASSO_TYPE_SERVER (lasso_server_get_type())
#define LASSO_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SERVER, LassoServer))
@ -95,9 +86,6 @@ LASSO_EXPORT gint lasso_server_add_provider_from_buffer (LassoServer *server,
LassoProviderRole role, const gchar *metadata,
const gchar *public_key, const gchar *ca_cert_chain);
LASSO_EXPORT gint lasso_server_add_service(LassoServer *server, LassoNode *service);
LASSO_EXPORT gint lasso_server_add_service_from_dump(LassoServer *server, const gchar *dump);
LASSO_EXPORT void lasso_server_destroy(LassoServer *server);
LASSO_EXPORT gchar* lasso_server_dump(LassoServer *server);
@ -105,9 +93,6 @@ LASSO_EXPORT gchar* lasso_server_dump(LassoServer *server);
LASSO_EXPORT LassoProvider* lasso_server_get_provider(LassoServer *server,
const gchar *providerID);
LASSO_EXPORT LassoDiscoServiceInstance* lasso_server_get_service(LassoServer *server,
const gchar *serviceType);
LASSO_EXPORT int lasso_server_set_encryption_private_key(LassoServer *server,
const gchar *filename);

View File

@ -29,26 +29,21 @@
**/
#include "../xml/private.h"
#include <lasso/id-ff/session.h>
#include <lasso/id-ff/sessionprivate.h>
#include <lasso/xml/saml_assertion.h>
#include <lasso/xml/saml-2.0/saml2_assertion.h>
#include "session.h"
#include "sessionprivate.h"
#include "../xml/saml_assertion.h"
#include "../xml/saml-2.0/saml2_assertion.h"
#include "../utils.h"
#ifdef LASSO_WSF_ENABLED
#include <lasso/id-wsf-2.0/session.h>
#include <lasso/xml/misc_text_node.h>
#include <lasso/xml/id-wsf-2.0/disco_svc_metadata.h>
#include <lasso/xml/id-wsf-2.0/disco_service_type.h>
#include <lasso/xml/id-wsf-2.0/disco_security_context.h>
#include <lasso/xml/id-wsf-2.0/sec_token.h>
#endif
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <xmlsec/xmltree.h>
#include <xmlsec/base64.h>
#ifdef LASSO_WSF_ENABLED
#include "../id-wsf-2.0/sessionprivate.h"
#endif
/*****************************************************************************/
/* public methods */
/*****************************************************************************/
@ -422,80 +417,6 @@ lasso_session_remove_status(LassoSession *session, const gchar *providerID)
return LASSO_PROFILE_ERROR_MISSING_STATUS_CODE;
}
#ifdef LASSO_WSF_ENABLED
gint
lasso_session_add_endpoint_reference(LassoSession *session, LassoWsAddrEndpointReference *epr)
{
GList *i;
g_return_val_if_fail(LASSO_IS_SESSION(session), LASSO_PARAM_ERROR_INVALID_VALUE);
g_return_val_if_fail(LASSO_IS_WSA_ENDPOINT_REFERENCE(epr), LASSO_PARAM_ERROR_INVALID_VALUE);
for (i = g_list_first(epr->Metadata->any); i != NULL; i = g_list_next(i)) {
if (LASSO_IS_IDWSF2_DISCO_SERVICE_TYPE(i->data)) {
g_hash_table_insert(session->private_data->eprs,
g_strdup(LASSO_IDWSF2_DISCO_SERVICE_TYPE(i->data)->content),
g_object_ref(epr));
lasso_private_data(session)->is_dirty = TRUE;
break;
}
}
return 0;
}
LassoWsAddrEndpointReference*
lasso_session_get_endpoint_reference(LassoSession *session, const gchar *service_type)
{
LassoWsAddrEndpointReference* epr;
g_return_val_if_fail(LASSO_IS_SESSION(session), NULL);
g_return_val_if_fail(service_type != NULL, NULL);
epr = g_hash_table_lookup(session->private_data->eprs, service_type);
if (LASSO_IS_WSA_ENDPOINT_REFERENCE(epr)) {
return LASSO_WSA_ENDPOINT_REFERENCE(epr);
} else {
return NULL;
}
}
LassoSaml2Assertion*
lasso_session_get_assertion_identity_token(LassoSession *session, const gchar *service_type)
{
LassoWsAddrEndpointReference* epr;
GList *metadata_item;
GList *i;
LassoIdWsf2DiscoSecurityContext *security_context;
LassoIdWsf2SecToken *sec_token;
LassoSaml2Assertion *assertion = NULL;
if (LASSO_IS_SESSION(session) == FALSE) {
return NULL;
}
epr = lasso_session_get_endpoint_reference(session, service_type);
if (epr == NULL || epr->Metadata == NULL) {
return NULL;
}
metadata_item = epr->Metadata->any;
for (i = g_list_first(metadata_item); i != NULL; i = g_list_next(i)) {
if (LASSO_IS_IDWSF2_DISCO_SECURITY_CONTEXT(i->data)) {
security_context = LASSO_IDWSF2_DISCO_SECURITY_CONTEXT(i->data);
if (security_context->Token != NULL) {
sec_token = security_context->Token->data;
if (LASSO_IS_SAML2_ASSERTION(sec_token->any)) {
lasso_assign_new_gobject(assertion, sec_token->any);
break;
}
}
}
}
return assertion;
}
#endif
/*****************************************************************************/
/* private methods */
@ -574,26 +495,12 @@ add_status_childnode(gchar *key, LassoSamlpStatus *value, DumpContext *context)
xmlAddChild(t, lasso_node_get_xmlNode(LASSO_NODE(value), TRUE));
}
#ifdef LASSO_WSF_ENABLED
static void
add_childnode_from_hashtable(G_GNUC_UNUSED gchar *key, LassoNode *value, DumpContext *context)
{
xmlNode *xmlnode;
xmlnode = context->parent;
xmlAddChild(xmlnode, lasso_node_get_xmlNode(LASSO_NODE(value), TRUE));
}
#endif
static xmlNode*
get_xmlNode(LassoNode *node, G_GNUC_UNUSED gboolean lasso_dump)
{
xmlNode *xmlnode;
LassoSession *session = LASSO_SESSION(node);
DumpContext context;
#ifdef LASSO_WSF_ENABLED
xmlNode *t;
#endif
xmlnode = xmlNewNode(NULL, (xmlChar*)"Session");
context.parent = xmlnode;
@ -613,14 +520,7 @@ get_xmlNode(LassoNode *node, G_GNUC_UNUSED gboolean lasso_dump)
}
#ifdef LASSO_WSF_ENABLED
/* Endpoint References */
if (session->private_data->eprs != NULL
&& g_hash_table_size(session->private_data->eprs)) {
t = xmlNewTextChild(xmlnode, NULL, (xmlChar*)"EndpointReferences", NULL);
context.parent = t;
g_hash_table_foreach(session->private_data->eprs,
(GHFunc)add_childnode_from_hashtable, &context);
}
lasso_session_id_wsf2_dump_eprs(session, xmlnode);
#endif
return xmlnode;
@ -658,9 +558,6 @@ init_from_xml(LassoNode *node, xmlNode *xmlnode)
LassoSession *session = LASSO_SESSION(node);
xmlNode *t;
xmlNode *n;
#ifdef LASSO_WSF_ENABLED
xmlNode *t2;
#endif
t = xmlnode->children;
while (t) {
@ -715,23 +612,7 @@ init_from_xml(LassoNode *node, xmlNode *xmlnode)
}
#ifdef LASSO_WSF_ENABLED
/* Endpoint References */
if (strcmp((char*)t->name, "EndpointReferences") == 0) {
t2 = t->children;
while (t2) {
LassoWsAddrEndpointReference *epr;
if (t2->type != XML_ELEMENT_NODE) {
t2 = t2->next;
continue;
}
epr = LASSO_WSA_ENDPOINT_REFERENCE(
lasso_wsa_endpoint_reference_new());
LASSO_NODE_GET_CLASS(epr)->init_from_xml(LASSO_NODE(epr), t2);
lasso_session_add_endpoint_reference(session, epr);
g_object_unref(epr);
t2 = t2->next;
}
}
lasso_session_id_wsf2_init_eprs(session, t);
#endif
t = t->next;
@ -894,6 +775,7 @@ lasso_session_new_from_dump(const gchar *dump)
session = lasso_session_new();
init_from_xml(LASSO_NODE(session), rootElement);
lasso_release_doc(doc);
lasso_private_data(session)->is_dirty = FALSE;
return session;
}

View File

@ -29,8 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/lasso_config.h>
#include <lasso/xml/xml.h>
#include "../xml/xml.h"
#ifndef OFTYPE
#define OFTYPE(x)

View File

@ -29,10 +29,11 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/lib_assertion.h>
#include <lasso/xml/samlp_status.h>
#include <lasso/id-ff/session.h>
#include <lasso/xml/xml.h>
#include "../xml/lib_assertion.h"
#include "../xml/samlp_status.h"
#include "session.h"
#include "../xml/xml.h"
#include "lasso/lasso_config.h"
struct _LassoSessionPrivate
{

View File

@ -9,12 +9,22 @@ INCLUDES = \
noinst_LTLIBRARIES = liblasso-id-wsf2.la
lasso_private_h_sources = \
serverprivate.h \
sessionprivate.h \
saml2_login_private.h
liblasso_id_wsf2_la_SOURCES = \
server.c \
session.c \
identity.c \
discovery.c \
data_service.c \
profile.c
profile.c \
saml2_login.c
liblassoinclude_HEADERS = \
id_wsf_2.h
discovery.h \
data_service.h \
profile.h \
@ -22,3 +32,4 @@ liblassoinclude_HEADERS = \
server.h \
session.h
EXTRADIST = $(lasso_private_h_sources)

View File

@ -34,20 +34,20 @@
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <lasso/id-wsf-2.0/discovery.h>
#include <lasso/id-wsf-2.0/data_service.h>
#include "discovery.h"
#include "data_service.h"
#include <lasso/xml/id-wsf-2.0/disco_service_type.h>
#include <lasso/xml/id-wsf-2.0/dstref_query.h>
#include <lasso/xml/id-wsf-2.0/dstref_query_response.h>
#include <lasso/xml/id-wsf-2.0/dstref_data.h>
#include <lasso/xml/id-wsf-2.0/util_status.h>
#include <lasso/xml/id-wsf-2.0/sb2_redirect_request.h>
#include <lasso/xml/id-wsf-2.0/dstref_modify.h>
#include <lasso/xml/id-wsf-2.0/dstref_modify_item.h>
#include <lasso/xml/id-wsf-2.0/dstref_modify_response.h>
#include "../xml/id-wsf-2.0/disco_service_type.h"
#include "../xml/id-wsf-2.0/dstref_query.h"
#include "../xml/id-wsf-2.0/dstref_query_response.h"
#include "../xml/id-wsf-2.0/dstref_data.h"
#include "../xml/id-wsf-2.0/util_status.h"
#include "../xml/id-wsf-2.0/sb2_redirect_request.h"
#include "../xml/id-wsf-2.0/dstref_modify.h"
#include "../xml/id-wsf-2.0/dstref_modify_item.h"
#include "../xml/id-wsf-2.0/dstref_modify_response.h"
#include <lasso/xml/soap_fault.h>
#include "../xml/soap_fault.h"
#include "../utils.h"
#include "./private.h"

View File

@ -30,10 +30,10 @@ extern "C" {
#endif /* __cplusplus */
#include <lasso/id-wsf-2.0/profile.h>
#include <lasso/xml/xml.h>
#include <lasso/xml/id-wsf-2.0/dstref_query_item.h>
#include <lasso/xml/ws/wsa_endpoint_reference.h>
#include "profile.h"
#include "../xml/xml.h"
#include "../xml/id-wsf-2.0/dstref_query_item.h"
#include "../xml/ws/wsa_endpoint_reference.h"
#define LASSO_TYPE_IDWSF2_DATA_SERVICE (lasso_idwsf2_data_service_get_type())

View File

@ -38,38 +38,38 @@
#include <xmlsec/xmltree.h>
#include <lasso/xml/saml_attribute_value.h>
#include <lasso/xml/xml_enc.h>
#include "../xml/saml_attribute_value.h"
#include "../xml/xml_enc.h"
#include <lasso/xml/saml-2.0/saml2_assertion.h>
#include <lasso/xml/saml-2.0/samlp2_name_id_policy.h>
#include "../xml/saml-2.0/saml2_assertion.h"
#include "../xml/saml-2.0/samlp2_name_id_policy.h"
#include <lasso/xml/id-wsf-2.0/disco_query.h>
#include <lasso/xml/id-wsf-2.0/disco_requested_service.h>
#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/xml/id-wsf-2.0/disco_svc_md_association_add_response.h>
#include <lasso/xml/id-wsf-2.0/disco_abstract.h>
#include <lasso/xml/id-wsf-2.0/disco_provider_id.h>
#include <lasso/xml/id-wsf-2.0/disco_service_type.h>
#include <lasso/xml/id-wsf-2.0/disco_security_context.h>
#include <lasso/xml/id-wsf-2.0/disco_service_context.h>
#include <lasso/xml/id-wsf-2.0/disco_endpoint_context.h>
#include <lasso/xml/id-wsf-2.0/sec_token.h>
#include "../xml/id-wsf-2.0/disco_query.h"
#include "../xml/id-wsf-2.0/disco_requested_service.h"
#include "../xml/id-wsf-2.0/disco_svc_md_register.h"
#include "../xml/id-wsf-2.0/disco_svc_md_register_response.h"
#include "../xml/id-wsf-2.0/disco_svc_md_association_add.h"
#include "../xml/id-wsf-2.0/disco_svc_md_association_add_response.h"
#include "../xml/id-wsf-2.0/disco_svc_md_association_add_response.h"
#include "../xml/id-wsf-2.0/disco_abstract.h"
#include "../xml/id-wsf-2.0/disco_provider_id.h"
#include "../xml/id-wsf-2.0/disco_service_type.h"
#include "../xml/id-wsf-2.0/disco_security_context.h"
#include "../xml/id-wsf-2.0/disco_service_context.h"
#include "../xml/id-wsf-2.0/disco_endpoint_context.h"
#include "../xml/id-wsf-2.0/sec_token.h"
#include <lasso/xml/ws/wsa_endpoint_reference.h>
#include "../xml/ws/wsa_endpoint_reference.h"
#include <lasso/id-ff/server.h>
#include <lasso/id-ff/provider.h>
#include <lasso/id-ff/providerprivate.h>
#include "../id-ff/server.h"
#include "../id-ff/provider.h"
#include "../id-ff/providerprivate.h"
#include <lasso/id-wsf-2.0/discovery.h>
#include <lasso/id-wsf-2.0/profile.h>
#include <lasso/id-wsf-2.0/identity.h>
#include <lasso/id-wsf-2.0/server.h>
#include <lasso/id-wsf-2.0/session.h>
#include "discovery.h"
#include "profile.h"
#include "identity.h"
#include "server.h"
#include "session.h"
#include "../utils.h"
struct _LassoIdWsf2DiscoveryPrivate

View File

@ -30,12 +30,12 @@ extern "C" {
#endif /* __cplusplus */
#include <lasso/id-wsf-2.0/profile.h>
#include <lasso/id-wsf-2.0/data_service.h>
#include "profile.h"
#include "data_service.h"
#include <lasso/xml/id-wsf-2.0/disco_query.h>
#include <lasso/xml/id-wsf-2.0/disco_query_response.h>
#include <lasso/xml/id-wsf-2.0/disco_svc_metadata.h>
#include "../xml/id-wsf-2.0/disco_query.h"
#include "../xml/id-wsf-2.0/disco_query_response.h"
#include "../xml/id-wsf-2.0/disco_svc_metadata.h"
#define LASSO_TYPE_IDWSF2_DISCOVERY (lasso_idwsf2_discovery_get_type())
#define LASSO_IDWSF2_DISCOVERY(obj) \

View File

@ -0,0 +1,35 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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.
*
* 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.
*
* 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
*/
#ifndef __LASSO_IDWSF2_ID_WSF_2_H__
#define __LASSO_IDWSF2_ID_WSF_2_H__
#include "session.h"
#include "identity.h"
#include "discovery.h"
#include "data_service.h"
#include "server.h"
#endif /* __LASSO_IDWSF2_ID_WSF_2_H__ */

View File

@ -0,0 +1,48 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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.
*
* 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.
*
* 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
*/
#include "identity.h"
#include "../utils.h"
#include "../id-ff/identity.h"
#include "../id-ff/identityprivate.h"
gint
lasso_identity_add_svc_md_id(LassoIdentity *identity, gchar *svcMDID)
{
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(svcMDID != NULL, LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
lasso_list_add_string(identity->private_data->svcMDID, svcMDID);
identity->is_dirty = TRUE;
return 0;
}
GList*
lasso_identity_get_svc_md_ids(LassoIdentity *identity)
{
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), NULL);
return identity->private_data->svcMDID;
}

View File

@ -29,6 +29,10 @@
extern "C" {
#endif /* __cplusplus */
#include "../id-ff/identity.h"
#include "../export.h"
#include <glib.h>
LASSO_EXPORT gint lasso_identity_add_svc_md_id(LassoIdentity *identity, gchar *svcMDID);
LASSO_EXPORT GList* lasso_identity_get_svc_md_ids(LassoIdentity *identity);

View File

@ -31,22 +31,22 @@
#include <xmlsec/templates.h>
#include <xmlsec/crypto.h>
#include <lasso/id-ff/server.h>
#include <lasso/id-ff/serverprivate.h>
#include <lasso/id-ff/providerprivate.h>
#include "../id-ff/server.h"
#include "../id-ff/serverprivate.h"
#include "../id-ff/providerprivate.h"
#include <lasso/id-wsf-2.0/profile.h>
#include <lasso/id-wsf-2.0/session.h>
#include "profile.h"
#include "session.h"
#include <lasso/xml/soap_fault.h>
#include <lasso/xml/soap_binding_correlation.h>
#include <lasso/xml/soap_binding_provider.h>
#include <lasso/xml/soap_binding_processing_context.h>
#include <lasso/xml/xml_enc.h>
#include "../xml/soap_fault.h"
#include "../xml/soap_binding_correlation.h"
#include "../xml/soap_binding_provider.h"
#include "../xml/soap_binding_processing_context.h"
#include "../xml/xml_enc.h"
#include <lasso/xml/ws/wsse_security_header.h>
#include "../xml/ws/wsse_security_header.h"
#include <lasso/xml/saml-2.0/saml2_assertion.h>
#include "../xml/saml-2.0/saml2_assertion.h"
#include "../utils.h"
/*****************************************************************************/

View File

@ -29,8 +29,8 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/profile.h>
#include <lasso/xml/soap_envelope.h>
#include "../id-ff/profile.h"
#include "../xml/soap_envelope.h"
#define LASSO_TYPE_IDWSF2_PROFILE (lasso_idwsf2_profile_get_type())
#define LASSO_IDWSF2_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \

View File

@ -0,0 +1,206 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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.
*
* 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.
*
* 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
*/
#include "saml2_login_private.h"
#include "identity.h"
#include "server.h"
#include "session.h"
#include "../id-ff/login.h"
#include "../xml/saml-2.0/saml2_assertion.h"
#include "../xml/ws/wsa_endpoint_reference.h"
#include "../xml/id-wsf-2.0/disco_svc_metadata.h"
#include "../xml/id-wsf-2.0/disco_abstract.h"
#include "../xml/id-wsf-2.0/disco_provider_id.h"
#include "../xml/id-wsf-2.0/disco_service_type.h"
#include "../xml/id-wsf-2.0/disco_service_context.h"
#include "../xml/id-wsf-2.0/disco_security_context.h"
#include "../xml/id-wsf-2.0/sec_token.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"
#include "../xml/saml-2.0/samlp2_response.h"
void
lasso_saml20_login_assertion_add_discovery(LassoLogin *login, LassoSaml2Assertion *assertion)
{
GList *svcMDIDs;
GList *svcMDs;
LassoIdWsf2DiscoSvcMetadata *svcMD;
LassoWsAddrEndpointReference *epr;
LassoWsAddrMetadata *metadata;
LassoSaml2AttributeStatement *attributeStatement;
LassoSaml2Attribute *attribute;
LassoSaml2AttributeValue *attributeValue;
LassoIdWsf2DiscoSecurityContext *security_context;
LassoIdWsf2SecToken *sec_token;
LassoSaml2Assertion *assertion_identity_token;
LassoIdWsf2DiscoServiceContext *service_context;
LassoIdWsf2DiscoEndpointContext *endpoint_context;
/* Get metadatas ids to which the user is associated */
svcMDIDs = lasso_identity_get_svc_md_ids(LASSO_PROFILE(login)->identity);
/* Get the metadatas of type discovery to which the user is associated */
svcMDs = lasso_server_get_svc_metadatas_with_id_and_type(LASSO_PROFILE(login)->server,
svcMDIDs, LASSO_IDWSF2_DISCO_HREF);
if (svcMDs == NULL) {
/* If the user hasn't been associated to any discovery metadatas, */
/* get a default one */
svcMDs = lasso_server_get_svc_metadatas_with_id_and_type(
LASSO_PROFILE(login)->server, NULL, LASSO_IDWSF2_DISCO_HREF);
if (svcMDs != NULL && LASSO_IS_IDWSF2_DISCO_SVC_METADATA(svcMDs->data)) {
/* Then associate the user to these metadatas for later use */
lasso_identity_add_svc_md_id(LASSO_PROFILE(login)->identity,
LASSO_IDWSF2_DISCO_SVC_METADATA(svcMDs->data)->svcMDID);
} else {
return;
}
}
/* FIXME : foreach on the whole list and build on epr for each svcMD */
svcMD = svcMDs->data;
/* Check the metadatas contain the infos needed to build an EPR */
if (svcMD == NULL || svcMD->ServiceContext == NULL || svcMD->ServiceContext->data == NULL) {
g_list_foreach(svcMDs, (GFunc)lasso_node_destroy, NULL);
g_list_free(svcMDs);
return;
}
/* Build EndpointReference */
epr = lasso_wsa_endpoint_reference_new();
service_context = svcMD->ServiceContext->data;
endpoint_context = service_context->EndpointContext->data;
epr->Address = lasso_wsa_attributed_uri_new_with_string(
(gchar*)endpoint_context->Address->data);
metadata = lasso_wsa_metadata_new();
/* Abstract */
metadata->any = g_list_append(metadata->any,
lasso_idwsf2_disco_abstract_new_with_string(svcMD->Abstract));
/* ProviderID */
metadata->any = g_list_append(metadata->any,
lasso_idwsf2_disco_provider_id_new_with_string(svcMD->ProviderID));
/* ServiceType */
metadata->any = g_list_append(metadata->any,
lasso_idwsf2_disco_service_type_new_with_string(
(char*)service_context->ServiceType->data));
/* Framework */
if (endpoint_context->Framework != NULL) {
metadata->any = g_list_append(metadata->any,
g_object_ref(endpoint_context->Framework->data));
}
/* Identity token */
assertion_identity_token = LASSO_SAML2_ASSERTION(lasso_saml2_assertion_new());
assertion_identity_token->Subject = g_object_ref(assertion->Subject);
sec_token = lasso_idwsf2_sec_token_new();
sec_token->any = LASSO_NODE(assertion_identity_token);
security_context = lasso_idwsf2_disco_security_context_new();
security_context->SecurityMechID = g_list_append(
security_context->SecurityMechID, g_strdup(LASSO_SECURITY_MECH_TLS_BEARER));
security_context->Token = g_list_append(security_context->Token, sec_token);
metadata->any = g_list_append(metadata->any, security_context);
/* End of metadata construction */
epr->Metadata = metadata;
/* Add the EPR to the assertion as a SAML attribute */
attributeValue = lasso_saml2_attribute_value_new();
attributeValue->any = g_list_append(attributeValue->any, epr);
attribute = LASSO_SAML2_ATTRIBUTE(lasso_saml2_attribute_new());
attribute->Name = g_strdup(LASSO_SAML2_ATTRIBUTE_NAME_EPR);
attribute->NameFormat = g_strdup(LASSO_SAML2_ATTRIBUTE_NAME_FORMAT_URI);
attribute->AttributeValue = g_list_append(attribute->AttributeValue, attributeValue);
attributeStatement = LASSO_SAML2_ATTRIBUTE_STATEMENT(lasso_saml2_attribute_statement_new());
attributeStatement->Attribute = g_list_append(attributeStatement->Attribute, attribute);
assertion->AttributeStatement = g_list_append(assertion->AttributeStatement,
attributeStatement);
/* Free resources */
g_list_foreach(svcMDs, (GFunc)lasso_node_destroy, NULL);
g_list_free(svcMDs);
}
gint
lasso_saml20_login_copy_assertion_epr(LassoLogin *login)
{
LassoProfile *profile = LASSO_PROFILE(login);
LassoSession *session = profile->session;
LassoSaml2Assertion *assertion;
LassoSaml2AttributeStatement *attribute_statement;
LassoSaml2Attribute *attribute;
LassoSaml2AttributeValue *attribute_value;
LassoWsAddrEndpointReference *epr;
GList *i;
g_return_val_if_fail(LASSO_IS_SESSION(session), LASSO_PROFILE_ERROR_SESSION_NOT_FOUND);
assertion = LASSO_SAML2_ASSERTION(
LASSO_SAMLP2_RESPONSE(profile->response)->Assertion->data);
for (i = g_list_first(assertion->AttributeStatement); i; i = g_list_next(i)) {
GList *j;
attribute_statement = LASSO_SAML2_ATTRIBUTE_STATEMENT(i->data);
if (attribute_statement == NULL) {
continue;
}
for (j = g_list_first(attribute_statement->Attribute); j; j = g_list_next(j)) {
GList *k;
attribute = LASSO_SAML2_ATTRIBUTE(j->data);
if (attribute == NULL || attribute->Name == NULL) {
continue;
}
if (strcmp(attribute->Name, LASSO_SAML2_ATTRIBUTE_NAME_EPR) != 0) {
continue;
}
for (k = g_list_first(attribute->AttributeValue); k; k = g_list_next(k)) {
GList *l;
attribute_value = LASSO_SAML2_ATTRIBUTE_VALUE(k->data);
if (attribute_value == NULL) {
continue;
}
for (l = g_list_first(attribute_value->any);
l; l = g_list_next(l)) {
if (LASSO_IS_WSA_ENDPOINT_REFERENCE(l->data)) {
epr = LASSO_WSA_ENDPOINT_REFERENCE(l->data);
lasso_session_add_endpoint_reference(session, epr);
return 0;
}
}
}
}
}
return 0;
}

View File

@ -0,0 +1,43 @@
/* $Id: server.h 2945 2006-11-19 20:07:46Z dlaniel $
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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.
*
* 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.
*
* 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
*/
#ifndef __LASSO_IDWSF2_SAML2_LOGIN_PRIVATE_H__
#define __LASSO_IDWSF2_SAML2_LOGIN_PRIVATE_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "../id-ff/login.h"
#include "../xml/saml-2.0/saml2_assertion.h"
void lasso_saml20_login_assertion_add_discovery(LassoLogin *login, LassoSaml2Assertion *assertion);
gint lasso_saml20_login_copy_assertion_epr(LassoLogin *login);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_IDWSF2_SAML2_LOGIN_PRIVATE_H__ */

132
lasso/id-wsf-2.0/server.c Normal file
View File

@ -0,0 +1,132 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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.
*
* 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.
*
* 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
*/
#include "server.h"
#include "../id-ff/server.h"
#include "../id-ff/serverprivate.h"
#include "../xml/id-wsf-2.0/disco_svc_metadata.h"
#include "../xml/id-wsf-2.0/disco_service_context.h"
#include <libxml/tree.h>
gint
lasso_server_add_svc_metadata(LassoServer *server, LassoIdWsf2DiscoSvcMetadata *metadata)
{
g_return_val_if_fail(LASSO_IS_SERVER(server), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(LASSO_IS_IDWSF2_DISCO_SVC_METADATA(metadata),
LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
server->private_data->svc_metadatas = g_list_append(
server->private_data->svc_metadatas, g_object_ref(metadata));
return 0;
}
const GList *
lasso_server_get_svc_metadatas(LassoServer *server)
{
g_return_val_if_fail(LASSO_IS_SERVER(server), NULL);
return server->private_data->svc_metadatas;
}
GList *
lasso_server_get_svc_metadatas_with_id_and_type(LassoServer *server, GList *svcMDIDs,
const gchar *service_type)
{
gchar *svcMDID;
LassoIdWsf2DiscoSvcMetadata *md;
GList *result = NULL;
GList *i;
GList *j;
g_return_val_if_fail(LASSO_IS_SERVER(server), NULL);
g_return_val_if_fail(service_type != NULL, NULL);
for (i = g_list_first(server->private_data->svc_metadatas); i != NULL; i = g_list_next(i)) {
md = LASSO_IDWSF2_DISCO_SVC_METADATA(i->data);
/* FIXME: this assumes there is one and only one service
* context, and service type, this should be fixed to iterate
* properly on the GList */
if (md->ServiceContext == NULL || strcmp((char*)(LASSO_IDWSF2_DISCO_SERVICE_CONTEXT(
md->ServiceContext->data)->ServiceType)->data, service_type) != 0) {
continue;
}
if (svcMDIDs == NULL) {
/* If no svcMDID is given, return all the metadatas with given */
/* service type */
result = g_list_append(result, g_object_ref(md));
} else {
for (j = g_list_first(svcMDIDs); j != NULL; j = g_list_next(j)) {
svcMDID = (gchar *)(j->data);
if (strcmp(svcMDID, md->svcMDID) == 0) {
result = g_list_append(result, g_object_ref(md));
}
}
}
}
return result;
}
void
lasso_server_init_id_wsf20_svcmds(LassoServer *server, xmlNode *t)
{
xmlNode *t2 = t->children;
if (strcmp((char*)t->name, "SvcMDs") == 0) {
while (t2) {
LassoIdWsf2DiscoSvcMetadata *svcMD;
if (t2->type != XML_ELEMENT_NODE) {
t2 = t2->next;
continue;
}
svcMD = lasso_idwsf2_disco_svc_metadata_new();
LASSO_NODE_GET_CLASS(svcMD)->init_from_xml(LASSO_NODE(svcMD), t2);
server->private_data->svc_metadatas = g_list_append(
server->private_data->svc_metadatas, svcMD);
t2 = t2->next;
}
}
}
static void
add_childnode_from_list(LassoNode *value, xmlNode *xmlnode)
{
xmlAddChild(xmlnode, lasso_node_get_xmlNode(LASSO_NODE(value), TRUE));
}
void
lasso_server_dump_id_wsf20_svcmds(LassoServer *server, xmlNode *xmlnode)
{
/* Service Metadatas (SvcMD) */
if (server->private_data->svc_metadatas != NULL) {
xmlNode *t;
t = xmlNewTextChild(xmlnode, NULL, (xmlChar*)"SvcMDs", NULL);
g_list_foreach(server->private_data->svc_metadatas,
(GFunc)add_childnode_from_list, t);
}
}

View File

@ -25,13 +25,14 @@
#ifndef __LASSO_IDWSF2_SERVER_H__
#define __LASSO_IDWSF2_SERVER_H__
#include <lasso/utils.h>
#include "../utils.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/id-wsf-2.0/disco_svc_metadata.h>
#include "../id-ff/server.h"
#include "../xml/id-wsf-2.0/disco_svc_metadata.h"
LASSO_EXPORT gint lasso_server_add_svc_metadata(LassoServer *server,
LassoIdWsf2DiscoSvcMetadata *metadata);
@ -42,6 +43,8 @@ LASSO_EXPORT const GList OFTYPE(LassoIdWsf2DiscoSvcMetadata) *lasso_server_get_s
LASSO_EXPORT GList *lasso_server_get_svc_metadatas_with_id_and_type(LassoServer *server,
GList *svcMDIDs, const gchar *service_type);
void lasso_server_init_id_wsf20_services(LassoServer *server, xmlNode *t);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -0,0 +1,45 @@
/* $Id: server.h 2945 2006-11-19 20:07:46Z dlaniel $
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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.
*
* 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.
*
* 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
*/
#ifndef __LASSO_IDWSF2_SERVERPRIVATE_H__
#define __LASSO_IDWSF2_SERVERPRIVATE_H__
#include "../utils.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "../id-ff/server.h"
#include <libxml/tree.h>
void lasso_server_init_id_wsf20_svcmds(LassoServer *server, xmlNode *t);
void lasso_server_dump_id_wsf20_svcmds(LassoServer *server, xmlNode *xmlnode);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_IDWSF2_SERVERPRIVATE_H__ */

182
lasso/id-wsf-2.0/session.c Normal file
View File

@ -0,0 +1,182 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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.
*
* 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.
*
* 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
*/
/**
* SECTION:idwsf2-session-extension
*/
#include "session.h"
#include "../utils.h"
#include "../id-ff/session.h"
#include "../id-ff/sessionprivate.h"
#include "../xml/misc_text_node.h"
#include "../xml/ws/wsa_endpoint_reference.h"
#include "../xml/saml-2.0/saml2_assertion.h"
#include "../xml/id-wsf-2.0/disco_svc_metadata.h"
#include "../xml/id-wsf-2.0/disco_service_type.h"
#include "../xml/id-wsf-2.0/disco_security_context.h"
#include "../xml/id-wsf-2.0/sec_token.h"
typedef struct _DumpContext {
xmlNode *parent;
} DumpContext;
/**
* lasso_session_add_endpoint_reference:
* @session: a #LassoSession object
* @epr: a #LassoWsAddrEndpointReference object
*
* Add an endpoint reference to a session object.
*
* Return value: 0 if successfull, an error code otherwise.
*/
gint
lasso_session_add_endpoint_reference(LassoSession *session, LassoWsAddrEndpointReference *epr)
{
GList *i;
g_return_val_if_fail(LASSO_IS_SESSION(session), LASSO_PARAM_ERROR_INVALID_VALUE);
g_return_val_if_fail(LASSO_IS_WSA_ENDPOINT_REFERENCE(epr), LASSO_PARAM_ERROR_INVALID_VALUE);
for (i = g_list_first(epr->Metadata->any); i != NULL; i = g_list_next(i)) {
if (LASSO_IS_IDWSF2_DISCO_SERVICE_TYPE(i->data)) {
g_hash_table_insert(session->private_data->eprs,
g_strdup(LASSO_IDWSF2_DISCO_SERVICE_TYPE(i->data)->content),
g_object_ref(epr));
lasso_private_data(session)->is_dirty = TRUE;
break;
}
}
return 0;
}
LassoWsAddrEndpointReference*
lasso_session_get_endpoint_reference(LassoSession *session, const gchar *service_type)
{
LassoWsAddrEndpointReference* epr;
g_return_val_if_fail(LASSO_IS_SESSION(session), NULL);
g_return_val_if_fail(service_type != NULL, NULL);
epr = g_hash_table_lookup(session->private_data->eprs, service_type);
if (LASSO_IS_WSA_ENDPOINT_REFERENCE(epr)) {
return LASSO_WSA_ENDPOINT_REFERENCE(epr);
} else {
return NULL;
}
}
/**
* lasso_session_get_assertion_identity_token:
* @session: a #LassoSession object
* @service_type: a char* string describing the targeted service
*
* Return a security token to contact a specified service.
*
* Return value: 0 if successfull, an error otherwise.
*/
LassoSaml2Assertion*
lasso_session_get_assertion_identity_token(LassoSession *session, const gchar *service_type)
{
LassoWsAddrEndpointReference* epr;
GList *metadata_item;
GList *i;
LassoIdWsf2DiscoSecurityContext *security_context;
LassoIdWsf2SecToken *sec_token;
LassoSaml2Assertion *assertion = NULL;
if (LASSO_IS_SESSION(session) == FALSE) {
return NULL;
}
epr = lasso_session_get_endpoint_reference(session, service_type);
if (epr == NULL || epr->Metadata == NULL) {
return NULL;
}
metadata_item = epr->Metadata->any;
for (i = g_list_first(metadata_item); i != NULL; i = g_list_next(i)) {
if (LASSO_IS_IDWSF2_DISCO_SECURITY_CONTEXT(i->data)) {
security_context = LASSO_IDWSF2_DISCO_SECURITY_CONTEXT(i->data);
if (security_context->Token != NULL) {
sec_token = security_context->Token->data;
if (LASSO_IS_SAML2_ASSERTION(sec_token->any)) {
lasso_assign_new_gobject(assertion, sec_token->any);
break;
}
}
}
}
return assertion;
}
void
lasso_session_id_wsf2_init_eprs(LassoSession *session, xmlNode *t)
{
xmlNode *t2;
/* Endpoint References */
if (strcmp((char*)t->name, "EndpointReferences") == 0) {
t2 = t->children;
while (t2) {
LassoWsAddrEndpointReference *epr;
if (t2->type != XML_ELEMENT_NODE) {
t2 = t2->next;
continue;
}
epr = LASSO_WSA_ENDPOINT_REFERENCE(
lasso_wsa_endpoint_reference_new());
LASSO_NODE_GET_CLASS(epr)->init_from_xml(LASSO_NODE(epr), t2);
lasso_session_add_endpoint_reference(session, epr);
g_object_unref(epr);
t2 = t2->next;
}
}
}
static void
add_childnode_from_hashtable(G_GNUC_UNUSED gchar *key, LassoNode *value, DumpContext *context)
{
xmlNode *xmlnode;
xmlnode = context->parent;
xmlAddChild(xmlnode, lasso_node_get_xmlNode(LASSO_NODE(value), TRUE));
}
void
lasso_session_id_wsf2_dump_eprs(LassoSession *session, xmlNode *xmlnode) {
xmlNode *t;
DumpContext context;
/* Endpoint References */
if (session->private_data->eprs != NULL
&& g_hash_table_size(session->private_data->eprs)) {
t = xmlNewTextChild(xmlnode, NULL, (xmlChar*)"EndpointReferences", NULL);
context.parent = t;
g_hash_table_foreach(session->private_data->eprs,
(GHFunc)add_childnode_from_hashtable, &context);
}
}

View File

@ -1,4 +1,4 @@
/* $Id: session.h 2633 2005-09-05 10:00:07Z dlaniel $
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
@ -29,9 +29,9 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/saml-2.0/saml2_assertion.h>
#include <lasso/xml/ws/wsa_endpoint_reference.h>
#include "../id-ff/session.h"
#include "../xml/saml-2.0/saml2_assertion.h"
#include "../xml/ws/wsa_endpoint_reference.h"
LASSO_EXPORT gint lasso_session_add_endpoint_reference(LassoSession *session,
LassoWsAddrEndpointReference *epr);

View File

@ -0,0 +1,44 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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.
*
* 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.
*
* 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
*/
#ifndef __LASSO_IDWSF2_SERVERPRIVATE_H__
#define __LASSO_IDWSF2_SERVERPRIVATE_H__
#include "../utils.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "../id-ff/session.h"
#include <libxml/tree.h>
void lasso_session_id_wsf2_init_eprs(LassoSession *session, xmlNode *t);
void lasso_session_id_wsf2_dump_eprs(LassoSession *session, xmlNode *xmlnode);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_IDWSF2_SERVERPRIVATE_H__ */

View File

@ -8,7 +8,8 @@ INCLUDES = \
-DG_LOG_DOMAIN=\"lasso\"
lasso_private_h_sources = \
wsf_profile_private.h
wsf_profile_private.h \
id_ff_extensions_private.h
if WSF_ENABLED
noinst_LTLIBRARIES = liblasso-id-wsf.la
@ -19,17 +20,19 @@ WSF_C_FILES = \
personal_profile_service.c \
data_service.c \
wsf_profile.c \
utils.c
utils.c \
id_ff_extensions.c
WSF_H_FILES = \
id_wsf.h \
authentication.h \
discovery.h \
identity.h \
interaction_profile_service.h \
personal_profile_service.h \
data_service.h \
wsf_profile.h \
utils.h
utils.h \
id_ff_extensions.h
endif
liblasso_id_wsf_la_SOURCES = $(WSF_C_FILES)

View File

@ -23,10 +23,10 @@
*/
#include "../xml/private.h"
#include <lasso/id-wsf/authentication.h>
#include <lasso/xml/sa_sasl_request.h>
#include <lasso/xml/sa_sasl_response.h>
#include <lasso/xml/soap_binding_correlation.h>
#include "authentication.h"
#include "../xml/sa_sasl_request.h"
#include "../xml/sa_sasl_response.h"
#include "../xml/soap_binding_correlation.h"
#include <xmlsec/base64.h>
/* SASL client callbacks (for secret, login, password, ... ) */

View File

@ -32,8 +32,8 @@ extern "C" {
#include <sasl/sasl.h>
#include <lasso/id-wsf/wsf_profile.h>
#include <lasso/xml/disco_description.h>
#include "wsf_profile.h"
#include "../xml/disco_description.h"
#define LASSO_TYPE_AUTHENTICATION (lasso_authentication_get_type())
#define LASSO_AUTHENTICATION(obj) \

View File

@ -61,15 +61,15 @@
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <lasso/id-wsf/discovery.h>
#include <lasso/id-wsf/data_service.h>
#include <lasso/xml/dst_query.h>
#include <lasso/xml/dst_query_response.h>
#include <lasso/xml/dst_modify.h>
#include <lasso/xml/dst_modify_response.h>
#include <lasso/xml/soap_binding_correlation.h>
#include <lasso/xml/soap_fault.h>
#include <lasso/xml/is_redirect_request.h>
#include "discovery.h"
#include "data_service.h"
#include "../xml/dst_query.h"
#include "../xml/dst_query_response.h"
#include "../xml/dst_modify.h"
#include "../xml/dst_modify_response.h"
#include "../xml/soap_binding_correlation.h"
#include "../xml/soap_fault.h"
#include "../xml/is_redirect_request.h"
#include <xmlsec/xmltree.h>
#include <xmlsec/xmldsig.h>

View File

@ -30,15 +30,15 @@ extern "C" {
#endif /* __cplusplus */
#include <lasso/id-wsf/wsf_profile.h>
#include <lasso/xml/disco_resource_id.h>
#include <lasso/xml/disco_encrypted_resource_id.h>
#include <lasso/xml/dst_data.h>
#include <lasso/xml/dst_modification.h>
#include <lasso/xml/dst_query_item.h>
#include <lasso/xml/disco_resource_offering.h>
#include <lasso/xml/xml.h>
#include <lasso/xml/saml_assertion.h>
#include "wsf_profile.h"
#include "../xml/disco_resource_id.h"
#include "../xml/disco_encrypted_resource_id.h"
#include "../xml/dst_data.h"
#include "../xml/dst_modification.h"
#include "../xml/dst_query_item.h"
#include "../xml/disco_resource_offering.h"
#include "../xml/xml.h"
#include "../xml/saml_assertion.h"
#define LASSO_TYPE_DATA_SERVICE (lasso_data_service_get_type())
#define LASSO_DATA_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \

View File

@ -0,0 +1,371 @@
/* $Id$
*
*
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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.
*
* 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.
*
* 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
*/
#include "id_ff_extensions.h"
#include "id_ff_extensions_private.h"
#include "../xml/disco_description.h"
#include "../xml/disco_resource_offering.h"
#include "../xml/disco_service_instance.h"
#include "../xml/id-wsf-2.0/disco_service_context.h"
#include "../id-ff/profile.h"
#include "../id-ff/server.h"
#include "../id-ff/loginprivate.h"
#include "../id-ff/serverprivate.h"
#include "../id-ff/identityprivate.h"
#include "../xml/saml_attribute.h"
#include "../xml/saml_attribute_value.h"
#include "../xml/saml_attribute_statement.h"
#include "../id-wsf-2.0/server.h"
/**
* lasso_login_assertion_add_discovery:
* @login: a #LassoLogin
* @assertion:
*
* Adds AttributeStatement and ResourceOffering attributes to assertion if
* there is a discovery service.
**/
void
lasso_login_assertion_add_discovery(LassoLogin *login, LassoSamlAssertion *assertion)
{
LassoProfile *profile = LASSO_PROFILE(login);
LassoDiscoResourceOffering *resourceOffering;
LassoDiscoServiceInstance *serviceInstance, *newServiceInstance;
LassoSamlAttributeStatement *attributeStatement;
LassoSamlAttribute *attribute;
LassoSamlAttributeValue *attributeValue;
serviceInstance = lasso_server_get_service(profile->server, LASSO_DISCO_HREF);
if (LASSO_IS_DISCO_SERVICE_INSTANCE(serviceInstance) &&
login->private_data->resourceId) {
newServiceInstance = lasso_disco_service_instance_copy(serviceInstance);
resourceOffering = lasso_disco_resource_offering_new(newServiceInstance);
lasso_release_gobject(newServiceInstance);
lasso_assign_gobject(resourceOffering->ResourceID, login->private_data->resourceId);
attributeValue = lasso_saml_attribute_value_new();
lasso_list_add_new_gobject(attributeValue->any, resourceOffering);
attribute = lasso_saml_attribute_new();
lasso_assign_string(attribute->attributeName, "DiscoveryResourceOffering");
lasso_assign_string(attribute->attributeNameSpace, LASSO_DISCO_HREF);
lasso_list_add_new_gobject(attribute->AttributeValue, attributeValue);
attributeStatement = lasso_saml_attribute_statement_new();
lasso_list_add_new_gobject(attributeStatement->Attribute, attribute);
lasso_assign_new_gobject(assertion->AttributeStatement, attributeStatement);
/* FIXME: Add CredentialsRef and saml:Advice Assertions */
}
}
/**
* lasso_login_set_encryptedResourceId:
* @login: a #LassoLogin
* @encryptedResourceId:
*
* ...
*
* Return value: 0 on success; or a negative value otherwise.
**/
int
lasso_login_set_encryptedResourceId(LassoLogin *login,
LassoDiscoEncryptedResourceID *encryptedResourceId)
{
g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(LASSO_IS_DISCO_ENCRYPTED_RESOURCE_ID(encryptedResourceId),
LASSO_PARAM_ERROR_INVALID_VALUE);
lasso_assign_gobject(login->private_data->encryptedResourceId, encryptedResourceId);
return 0;
}
/**
* lasso_login_set_resourceId:
* @login: a #LassoLogin
* @content:
*
* ...
*
* Return value: 0 on success; or a negative value otherwise.
**/
int
lasso_login_set_resourceId(LassoLogin *login, const char *content)
{
g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(content != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
lasso_assign_new_gobject(login->private_data->resourceId, lasso_disco_resource_id_new(content));
return 0;
}
/**
* lasso_server_add_service:
* @server: a #LassoServer
* @service: a #LassoNode object implementing representing a service endpoint.
*
* Add a service to the registry of service of this #LassoServer object.
*
* Return value: 0 on success; a negative value if an error occured.
**/
gint
lasso_server_add_service(LassoServer *server, LassoNode *service)
{
g_return_val_if_fail(LASSO_IS_SERVER(server), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(service != NULL, LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
if (LASSO_IS_DISCO_SERVICE_INSTANCE(service)) {
g_hash_table_insert(server->services,
g_strdup(LASSO_DISCO_SERVICE_INSTANCE(service)->ServiceType),
g_object_ref(service));
} else if (LASSO_IS_IDWSF2_DISCO_SVC_METADATA(service)) {
return lasso_server_add_svc_metadata(server,
LASSO_IDWSF2_DISCO_SVC_METADATA(service));
} else {
return LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ;
}
return 0;
}
static void
add_service_childnode(G_GNUC_UNUSED gchar *key, LassoNode *value, xmlNode *xmlnode)
{
xmlAddChild(xmlnode, lasso_node_get_xmlNode(LASSO_NODE(value), TRUE));
}
void
lasso_server_dump_id_wsf_services(LassoServer *server, xmlNode *xmlnode)
{
if (g_hash_table_size(server->services)) {
xmlNode *t;
t = xmlNewTextChild(xmlnode, NULL, (xmlChar*)"Services", NULL);
g_hash_table_foreach(server->services,
(GHFunc)add_service_childnode, t);
}
}
void
lasso_server_init_id_wsf_services(LassoServer *server, xmlNode *t) {
xmlNode *t2 = t->children;
/* Services */
if (strcmp((char*)t->name, "Services") == 0) {
while (t2) {
LassoDiscoServiceInstance *s;
if (t2->type != XML_ELEMENT_NODE) {
t2 = t2->next;
continue;
}
s = g_object_new(LASSO_TYPE_DISCO_SERVICE_INSTANCE, NULL);
LASSO_NODE_GET_CLASS(s)->init_from_xml(LASSO_NODE(s), t2);
g_hash_table_insert(server->services, g_strdup(s->ServiceType), s);
t2 = t2->next;
}
}
}
/**
* lasso_identity_add_resource_offering:
* @identity: a #LassoIdentity object
* @offering: a #LassoDiscoResourceOffering object to add
*
* Add a new offering to the identity object to be retrieved later by
* lasso_identity_get_offerings() or lasso_identity_get_resource_offering().
* It also allocate an entryId identifier for the offering, look into
* offering->entryID to get it after this call.
*
* Return value: Always 0, there should not be any error (if memory is not exhausted).
*/
gint
lasso_identity_add_resource_offering(LassoIdentity *identity,
LassoDiscoResourceOffering *offering)
{
char entry_id_s[20];
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(LASSO_IS_DISCO_RESOURCE_OFFERING(offering),
LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
do {
g_snprintf(entry_id_s, 18, "%d", identity->private_data->last_entry_id);
identity->private_data->last_entry_id++;
} while (g_hash_table_lookup(identity->private_data->resource_offerings_map, entry_id_s));
lasso_assign_string(offering->entryID, entry_id_s);
g_hash_table_insert(identity->private_data->resource_offerings_map,
g_strdup(offering->entryID), g_object_ref(offering));
identity->is_dirty = TRUE;
return 0;
}
/**
* lasso_identity_remove_resource_offering:
* @identity: a #LassoIdentity
* @entryID: the resource offering entry ID
*
* Remove resource offering about identity with @entryID
*
* Return value: TRUE on success; FALSE if the offering was not found.
**/
gboolean
lasso_identity_remove_resource_offering(LassoIdentity *identity, const char *entryID)
{
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), FALSE);
g_return_val_if_fail(entryID != NULL, LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
if (g_hash_table_remove(identity->private_data->resource_offerings_map, entryID)) {
identity->is_dirty = TRUE;
return TRUE;
} else {
return FALSE;
}
}
/* Context type for the callback add_matching_resource_offering_to_list */
struct HelperStruct {
GList *list;
const char *service_type;
};
/*
* Helper function for lasso_identity_get_offerings, match them with a service
* type string */
static
void add_matching_resource_offering_to_list(G_GNUC_UNUSED char *name, LassoDiscoResourceOffering *offering,
struct HelperStruct *ctx)
{
if (ctx->service_type == NULL ||
( offering->ServiceInstance != NULL &&
offering->ServiceInstance->ServiceType != NULL &&
strcmp(offering->ServiceInstance->ServiceType, ctx->service_type) == 0)) {
lasso_list_add_gobject(ctx->list, offering);
}
}
/**
* lasso_identity_get_offerings:
* @identity: a #LassoIdentity
* @service_type: a char* string representing the type of service we are looking for
*
* Returns a list of #LassoDiscoResourceOffering associated to this service type.
*
* Return value: a newly allocated list of #LassoDiscoResourceOffering
*/
GList*
lasso_identity_get_offerings(LassoIdentity *identity, const char *service_type)
{
struct HelperStruct ctx = { NULL, service_type };
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), NULL);
g_hash_table_foreach(identity->private_data->resource_offerings_map,
(GHFunc)add_matching_resource_offering_to_list, &ctx);
return ctx.list;
}
/**
* lasso_identity_resource_offering:
* @identity: a #LassoIdentity
* @entryID: the entryID of the researched #LassoDiscoResourceOffering
*
* Lookup a #LassoDiscoResourceOffering corresponding to entryID, entryID is
* usually allocated by lasso_identity_add_resource_offering() inside
* offering->entryID.
*
* Return value: a #LassoDiscoResourceOffering, your must ref it if you intend
* to keep it around.
*/
LassoDiscoResourceOffering*
lasso_identity_get_resource_offering(LassoIdentity *identity, const char *entryID)
{
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), NULL);
g_return_val_if_fail(entryID != NULL, NULL);
return g_hash_table_lookup(identity->private_data->resource_offerings_map, entryID);
}
/**
* lasso_server_add_service_from_dump:
* @server: a #LassoServer
* @dump: the XML dump of a #LassoNode representing a service endpoint.
*
* An utility function that parse a #LassoNode dump an try to add it as a
* service using lasso_server_add_service.
*
* Return value: 0 if succesfull, LASSO_PARAM_ERROR_BAD_TYPE_OF_NULL_OBJECT if
* said dump is not a #LassoNode or is not of the righ type,
* LASSO_PARAM_ERROR_INVALID_VALUE if dump is NULL.
**/
gint
lasso_server_add_service_from_dump(LassoServer *server, const gchar *dump)
{
LassoNode *node;
gint return_code;
g_return_val_if_fail(dump != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
node = lasso_node_new_from_dump(dump);
return_code = lasso_server_add_service(server, node);
g_object_unref(node);
return return_code;
}
/**
* lasso_server_get_service:
* @server: a #LassoServer
* @serviceType:
*
* ...
*
* Return value: the #LassoDiscoServiceInstance, NULL if it was not found.
* The #LassoDiscoServiceInstance is owned by Lasso and should not be
* freed.
**/
LassoDiscoServiceInstance*
lasso_server_get_service(LassoServer *server, const gchar *serviceType)
{
return g_hash_table_lookup(server->services, serviceType);
}

View File

@ -22,14 +22,30 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LASSO_WSF_IDENTITY_H__
#define __LASSO_WSF_IDENTITY_H__
#ifndef __LASSO_WSF_ID_FF_EXTENSIONS_H__
#define __LASSO_WSF_ID_FF_EXTENSIONS_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/disco_resource_offering.h>
#include "../id-ff/login.h"
#include "../id-ff/server.h"
#include "../xml/disco_encrypted_resource_id.h"
#include "../xml/disco_service_instance.h"
#include "../xml/disco_resource_offering.h"
LASSO_EXPORT int lasso_login_set_encryptedResourceId(
LassoLogin *login, LassoDiscoEncryptedResourceID *encryptedResourceId);
LASSO_EXPORT int lasso_login_set_resourceId(LassoLogin *login, const char *content);
LASSO_EXPORT LassoDiscoServiceInstance* lasso_server_get_service(LassoServer *server,
const gchar *serviceType);
LASSO_EXPORT gint lasso_server_add_service(LassoServer *server, LassoNode *service);
LASSO_EXPORT gint lasso_server_add_service_from_dump(LassoServer *server, const gchar *dump);
LASSO_EXPORT gint lasso_identity_add_resource_offering(LassoIdentity *identity,
LassoDiscoResourceOffering *offering);
@ -44,4 +60,4 @@ LASSO_EXPORT LassoDiscoResourceOffering* lasso_identity_get_resource_offering(
}
#endif /* __cplusplus */
#endif /* __LASSO_WSF_IDENTITY_H__ */
#endif /* __LASSO_WSF_ID_FF_EXTENSIONS_H__ */

View File

@ -0,0 +1,47 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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.
*
* 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.
*
* 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
*/
#ifndef __LASSO_WSF_ID_FF_EXTENSIONS_H__
#define __LASSO_WSF_ID_FF_EXTENSIONS_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "../id-ff/login.h"
#include "../xml/saml_assertion.h"
void lasso_login_assertion_add_discovery(LassoLogin *login, LassoSamlAssertion *assertion);
void lasso_server_dump_id_wsf_services(LassoServer *server, xmlNode *xmlnode);
void lasso_server_init_id_wsf_services(LassoServer *server, xmlNode *t);
gint lasso_server_add_service(LassoServer *server, LassoNode *service);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_WSF_ID_FF_EXTENSIONS_H__ */

38
lasso/id-wsf/id_wsf.h Normal file
View File

@ -0,0 +1,38 @@
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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.
*
* 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.
*
* 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
*/
#ifndef __LASSO_IDSWF_H__
#define __LASSO_IDSWF_H__
#include "authentication.h"
#include "data_service.h"
#include "discovery.h"
#include "id_ff_extensions.h"
#include "id_wsf.h"
#include "interaction_profile_service.h"
#include "personal_profile_service.h"
#include "utils.h"
#include "wsf_profile.h"
#endif /* __LASSO_IDSWF_H__ */

View File

@ -30,9 +30,9 @@ extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/is_interaction_request.h>
#include <lasso/xml/is_interaction_response.h>
#include <lasso/id-wsf/wsf_profile.h>
#include "../xml/is_interaction_request.h"
#include "../xml/is_interaction_response.h"
#include "wsf_profile.h"
#define LASSO_TYPE_INTERACTION_PROFILE_SERVICE (lasso_interaction_profile_service_get_type())
#define LASSO_INTERACTION_PROFILE_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \

View File

@ -30,13 +30,13 @@ extern "C" {
#endif /* __cplusplus */
#include <lasso/id-wsf/data_service.h>
#include <lasso/xml/disco_resource_id.h>
#include <lasso/xml/disco_encrypted_resource_id.h>
#include <lasso/xml/dst_data.h>
#include <lasso/xml/dst_modification.h>
#include <lasso/xml/dst_query_item.h>
#include <lasso/xml/disco_resource_offering.h>
#include "data_service.h"
#include "../xml/disco_resource_id.h"
#include "../xml/disco_encrypted_resource_id.h"
#include "../xml/dst_data.h"
#include "../xml/dst_modification.h"
#include "../xml/dst_query_item.h"
#include "../xml/disco_resource_offering.h"
#define LASSO_TYPE_PERSONAL_PROFILE_SERVICE (lasso_personal_profile_service_get_type())
#define LASSO_PERSONAL_PROFILE_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \

View File

@ -36,7 +36,7 @@
#include <glib.h>
#include <string.h>
#include <lasso/xml/strings.h>
#include "../xml/strings.h"
/**
* lasso_security_mech_id_is_null_authentication:

View File

@ -30,16 +30,16 @@ extern "C" {
#endif /* __cplusplus */
#include <../id-ff/server.h>
#include <../id-ff/identity.h>
#include <../id-ff/session.h>
#include <../xml/soap_envelope.h>
#include <../xml/soap_binding_provider.h>
#include <../xml/soap_fault.h>
#include <../xml/saml_assertion.h>
#include <../xml/disco_description.h>
#include <../xml/disco_resource_offering.h>
#include <../xml/disco_description.h>
#include "../id-ff/server.h"
#include "../id-ff/identity.h"
#include "../id-ff/session.h"
#include "../xml/soap_envelope.h"
#include "../xml/soap_binding_provider.h"
#include "../xml/soap_fault.h"
#include "../xml/saml_assertion.h"
#include "../xml/disco_description.h"
#include "../xml/disco_resource_offering.h"
#include "../xml/disco_description.h"
#define LASSO_TYPE_WSF_PROFILE (lasso_wsf_profile_get_type())
#define LASSO_WSF_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
@ -105,8 +105,8 @@ LASSO_EXPORT gint lasso_wsf_profile_build_soap_response_msg(LassoWsfProfile *pro
LASSO_EXPORT gint lasso_wsf_profile_init_soap_request(LassoWsfProfile *profile, LassoNode *request);
LASSO_EXPORT gint lasso_wsf_profile_init_soap_response(LassoWsfProfile *profile, LassoNode
*response);
LASSO_EXPORT gint lasso_wsf_profile_init_soap_response(LassoWsfProfile *profile,
LassoNode *response);
LASSO_EXPORT gint lasso_wsf_profile_process_soap_request_msg(LassoWsfProfile *profile,
const gchar *message, const gchar *security_mech_id);

View File

@ -28,7 +28,6 @@
*
**/
#include "xml/private.h"
#include <stdlib.h> /* getenv */
#include <string.h> /* strcmp */
#include <xmlsec/xmlsec.h>
@ -36,9 +35,11 @@
#include <libxslt/xslt.h>
#include <config.h>
#include "lasso.h"
#include "lasso_config.h"
#include "debug.h"
#include "./backward_comp.h"
#include "./registry-private.h"
#include "backward_comp.h"
#include "registry-private.h"
#include "xml/private.h"
/* Set to true, it forces lasso_provider_verify_signature and lasso_query_verify_signature to always
* return TRUE. */

View File

@ -36,16 +36,16 @@ extern "C" {
#include <glib.h>
#include <glib-object.h>
#include <lasso/export.h>
#include "export.h"
#include <lasso/id-ff/defederation.h>
#include <lasso/id-ff/lecp.h>
#include <lasso/id-ff/login.h>
#include <lasso/id-ff/logout.h>
#include <lasso/id-ff/name_identifier_mapping.h>
#include <lasso/id-ff/name_registration.h>
#include <lasso/saml-2.0/name_id_management.h>
#include <lasso/saml-2.0/ecp.h>
#include "id-ff/defederation.h"
#include "id-ff/lecp.h"
#include "id-ff/login.h"
#include "id-ff/logout.h"
#include "id-ff/name_identifier_mapping.h"
#include "id-ff/name_registration.h"
#include "saml-2.0/name_id_management.h"
#include "saml-2.0/ecp.h"
LASSO_EXPORT int lasso_init(void);
LASSO_EXPORT int lasso_shutdown(void);

View File

@ -27,7 +27,7 @@
#define __REGISTRY_H__
#include <glib.h>
#include <lasso/lasso.h>
#include "lasso.h"
#ifdef __cplusplus
extern "C" {

View File

@ -23,20 +23,20 @@
*/
#include "../xml/private.h"
#include <lasso/saml-2.0/assertion_query.h>
#include <lasso/saml-2.0/providerprivate.h>
#include <lasso/saml-2.0/profileprivate.h>
#include <lasso/id-ff/providerprivate.h>
#include <lasso/id-ff/profileprivate.h>
#include <lasso/id-ff/identityprivate.h>
#include <lasso/id-ff/serverprivate.h>
#include <lasso/xml/xml_enc.h>
#include <lasso/xml/saml-2.0/samlp2_assertion_id_request.h>
#include <lasso/xml/saml-2.0/samlp2_authn_query.h>
#include <lasso/xml/saml-2.0/samlp2_attribute_query.h>
#include <lasso/xml/saml-2.0/samlp2_authz_decision_query.h>
#include <lasso/xml/saml-2.0/samlp2_response.h>
#include <lasso/xml/saml-2.0/samlp2_subject_query_abstract.h>
#include "assertion_query.h"
#include "providerprivate.h"
#include "profileprivate.h"
#include "../id-ff/providerprivate.h"
#include "../id-ff/profileprivate.h"
#include "../id-ff/identityprivate.h"
#include "../id-ff/serverprivate.h"
#include "../xml/xml_enc.h"
#include "../xml/saml-2.0/samlp2_assertion_id_request.h"
#include "../xml/saml-2.0/samlp2_authn_query.h"
#include "../xml/saml-2.0/samlp2_attribute_query.h"
#include "../xml/saml-2.0/samlp2_authz_decision_query.h"
#include "../xml/saml-2.0/samlp2_response.h"
#include "../xml/saml-2.0/samlp2_subject_query_abstract.h"
#include "../utils.h"

View File

@ -29,9 +29,9 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/profile.h>
#include <lasso/xml/saml-2.0/samlp2_manage_name_id_request.h>
#include <lasso/xml/saml-2.0/samlp2_manage_name_id_response.h>
#include "../id-ff/profile.h"
#include "../xml/saml-2.0/samlp2_manage_name_id_request.h"
#include "../xml/saml-2.0/samlp2_manage_name_id_response.h"
#define LASSO_TYPE_ASSERTION_QUERY (lasso_assertion_query_get_type())
#define LASSO_ASSERTION_QUERY(obj) \

View File

@ -32,15 +32,15 @@
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <lasso/saml-2.0/providerprivate.h>
#include <lasso/saml-2.0/profileprivate.h>
#include <lasso/id-ff/providerprivate.h>
#include <lasso/id-ff/identityprivate.h>
#include <lasso/id-ff/serverprivate.h>
#include "providerprivate.h"
#include "profileprivate.h"
#include "../id-ff/providerprivate.h"
#include "../id-ff/identityprivate.h"
#include "../id-ff/serverprivate.h"
#include <lasso/saml-2.0/ecpprivate.h>
#include "ecpprivate.h"
#include <lasso/saml-2.0/ecp.h>
#include "ecp.h"
#include "../utils.h"
/*****************************************************************************/

View File

@ -29,9 +29,9 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include "../xml/xml.h"
#include <lasso/id-ff/profile.h>
#include "../id-ff/profile.h"
#define LASSO_TYPE_ECP (lasso_ecp_get_type())
#define LASSO_ECP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_ECP, LassoEcp))

View File

@ -24,10 +24,10 @@
#include "../xml/private.h"
#include <lasso/id-ff/federation.h>
#include "../id-ff/federation.h"
#include "federationprivate.h"
#include <lasso/xml/saml-2.0/saml2_name_id.h>
#include "../xml/saml-2.0/saml2_name_id.h"
static LassoNode*

View File

@ -26,43 +26,33 @@
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <lasso/saml-2.0/providerprivate.h>
#include <lasso/saml-2.0/loginprivate.h>
#include <lasso/saml-2.0/profileprivate.h>
#include <lasso/saml-2.0/federationprivate.h>
#include "providerprivate.h"
#include "loginprivate.h"
#include "profileprivate.h"
#include "federationprivate.h"
#include <lasso/id-ff/providerprivate.h>
#include <lasso/id-ff/serverprivate.h>
#include <lasso/id-ff/login.h>
#include <lasso/id-ff/identityprivate.h>
#include <lasso/id-ff/sessionprivate.h>
#include <lasso/id-ff/loginprivate.h>
#include "../id-ff/providerprivate.h"
#include "../id-ff/serverprivate.h"
#include "../id-ff/login.h"
#include "../id-ff/identityprivate.h"
#include "../id-ff/sessionprivate.h"
#include "../id-ff/loginprivate.h"
#include <lasso/xml/xml_enc.h>
#include "../xml/xml_enc.h"
#include <lasso/xml/saml-2.0/samlp2_authn_request.h>
#include <lasso/xml/saml-2.0/samlp2_response.h>
#include <lasso/xml/saml-2.0/saml2_assertion.h>
#include <lasso/xml/saml-2.0/saml2_audience_restriction.h>
#include <lasso/xml/saml-2.0/saml2_authn_statement.h>
#include <lasso/xml/saml-2.0/saml2_encrypted_element.h>
#include <lasso/xml/saml-2.0/saml2_attribute.h>
#include <lasso/xml/saml-2.0/saml2_attribute_statement.h>
#include <lasso/xml/saml-2.0/saml2_attribute_value.h>
#include <lasso/xml/saml-2.0/saml2_name_id.h>
#include "../xml/saml-2.0/samlp2_authn_request.h"
#include "../xml/saml-2.0/samlp2_response.h"
#include "../xml/saml-2.0/saml2_assertion.h"
#include "../xml/saml-2.0/saml2_audience_restriction.h"
#include "../xml/saml-2.0/saml2_authn_statement.h"
#include "../xml/saml-2.0/saml2_encrypted_element.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"
#include "../xml/saml-2.0/saml2_name_id.h"
#ifdef LASSO_WSF_ENABLED
#include <lasso/id-wsf-2.0/identity.h>
#include <lasso/id-wsf-2.0/server.h>
#include <lasso/id-wsf-2.0/session.h>
#include <lasso/xml/ws/wsa_endpoint_reference.h>
#include <lasso/xml/id-wsf-2.0/disco_svc_metadata.h>
#include <lasso/xml/id-wsf-2.0/disco_abstract.h>
#include <lasso/xml/id-wsf-2.0/disco_provider_id.h>
#include <lasso/xml/id-wsf-2.0/disco_service_type.h>
#include <lasso/xml/id-wsf-2.0/disco_service_context.h>
#include <lasso/xml/id-wsf-2.0/disco_security_context.h>
#include <lasso/xml/id-wsf-2.0/sec_token.h>
#include "../id-wsf-2.0/saml2_login_private.h"
#endif
#include "../utils.h"
@ -612,123 +602,6 @@ lasso_saml20_login_process_federation(LassoLogin *login, gboolean is_consent_obt
}
#ifdef LASSO_WSF_ENABLED
static void
lasso_saml20_login_assertion_add_discovery(LassoLogin *login, LassoSaml2Assertion *assertion)
{
GList *svcMDIDs;
GList *svcMDs;
LassoIdWsf2DiscoSvcMetadata *svcMD;
LassoWsAddrEndpointReference *epr;
LassoWsAddrMetadata *metadata;
LassoSaml2AttributeStatement *attributeStatement;
LassoSaml2Attribute *attribute;
LassoSaml2AttributeValue *attributeValue;
LassoIdWsf2DiscoSecurityContext *security_context;
LassoIdWsf2SecToken *sec_token;
LassoSaml2Assertion *assertion_identity_token;
LassoIdWsf2DiscoServiceContext *service_context;
LassoIdWsf2DiscoEndpointContext *endpoint_context;
/* Get metadatas ids to which the user is associated */
svcMDIDs = lasso_identity_get_svc_md_ids(LASSO_PROFILE(login)->identity);
/* Get the metadatas of type discovery to which the user is associated */
svcMDs = lasso_server_get_svc_metadatas_with_id_and_type(LASSO_PROFILE(login)->server,
svcMDIDs, LASSO_IDWSF2_DISCO_HREF);
if (svcMDs == NULL) {
/* If the user hasn't been associated to any discovery metadatas, */
/* get a default one */
svcMDs = lasso_server_get_svc_metadatas_with_id_and_type(
LASSO_PROFILE(login)->server, NULL, LASSO_IDWSF2_DISCO_HREF);
if (svcMDs != NULL && LASSO_IS_IDWSF2_DISCO_SVC_METADATA(svcMDs->data)) {
/* Then associate the user to these metadatas for later use */
lasso_identity_add_svc_md_id(LASSO_PROFILE(login)->identity,
LASSO_IDWSF2_DISCO_SVC_METADATA(svcMDs->data)->svcMDID);
} else {
return;
}
}
/* FIXME : foreach on the whole list and build on epr for each svcMD */
svcMD = svcMDs->data;
/* Check the metadatas contain the infos needed to build an EPR */
if (svcMD == NULL || svcMD->ServiceContext == NULL || svcMD->ServiceContext->data == NULL) {
g_list_foreach(svcMDs, (GFunc)lasso_node_destroy, NULL);
g_list_free(svcMDs);
return;
}
/* Build EndpointReference */
epr = lasso_wsa_endpoint_reference_new();
service_context = svcMD->ServiceContext->data;
endpoint_context = service_context->EndpointContext->data;
epr->Address = lasso_wsa_attributed_uri_new_with_string(
(gchar*)endpoint_context->Address->data);
metadata = lasso_wsa_metadata_new();
/* Abstract */
metadata->any = g_list_append(metadata->any,
lasso_idwsf2_disco_abstract_new_with_string(svcMD->Abstract));
/* ProviderID */
metadata->any = g_list_append(metadata->any,
lasso_idwsf2_disco_provider_id_new_with_string(svcMD->ProviderID));
/* ServiceType */
metadata->any = g_list_append(metadata->any,
lasso_idwsf2_disco_service_type_new_with_string(
(char*)service_context->ServiceType->data));
/* Framework */
if (endpoint_context->Framework != NULL) {
metadata->any = g_list_append(metadata->any,
g_object_ref(endpoint_context->Framework->data));
}
/* Identity token */
assertion_identity_token = LASSO_SAML2_ASSERTION(lasso_saml2_assertion_new());
assertion_identity_token->Subject = g_object_ref(assertion->Subject);
sec_token = lasso_idwsf2_sec_token_new();
sec_token->any = LASSO_NODE(assertion_identity_token);
security_context = lasso_idwsf2_disco_security_context_new();
security_context->SecurityMechID = g_list_append(
security_context->SecurityMechID, g_strdup(LASSO_SECURITY_MECH_TLS_BEARER));
security_context->Token = g_list_append(security_context->Token, sec_token);
metadata->any = g_list_append(metadata->any, security_context);
/* End of metadata construction */
epr->Metadata = metadata;
/* Add the EPR to the assertion as a SAML attribute */
attributeValue = lasso_saml2_attribute_value_new();
attributeValue->any = g_list_append(attributeValue->any, epr);
attribute = LASSO_SAML2_ATTRIBUTE(lasso_saml2_attribute_new());
attribute->Name = g_strdup(LASSO_SAML2_ATTRIBUTE_NAME_EPR);
attribute->NameFormat = g_strdup(LASSO_SAML2_ATTRIBUTE_NAME_FORMAT_URI);
attribute->AttributeValue = g_list_append(attribute->AttributeValue, attributeValue);
attributeStatement = LASSO_SAML2_ATTRIBUTE_STATEMENT(lasso_saml2_attribute_statement_new());
attributeStatement->Attribute = g_list_append(attributeStatement->Attribute, attribute);
assertion->AttributeStatement = g_list_append(assertion->AttributeStatement,
attributeStatement);
/* Free resources */
g_list_foreach(svcMDs, (GFunc)lasso_node_destroy, NULL);
g_list_free(svcMDs);
}
#else
static void
lasso_saml20_login_assertion_add_discovery(G_GNUC_UNUSED LassoLogin *login, G_GNUC_UNUSED LassoSaml2Assertion *assertion)
{
}
#endif
int
lasso_saml20_login_build_assertion(LassoLogin *login,
const char *authenticationMethod,
@ -889,7 +762,9 @@ lasso_saml20_login_build_assertion(LassoLogin *login,
provider->private_data->encryption_sym_key_type;
}
#ifdef LASSO_WSF_ENABLED
lasso_saml20_login_assertion_add_discovery(login, assertion);
#endif
/* store assertion in session object */
if (profile->session == NULL) {
@ -1348,67 +1223,6 @@ cleanup:
return rc;
}
#ifdef LASSO_WSF_ENABLED
static gint
lasso_saml20_login_copy_assertion_epr(LassoLogin *login)
{
LassoProfile *profile = LASSO_PROFILE(login);
LassoSession *session = profile->session;
LassoSaml2Assertion *assertion;
LassoSaml2AttributeStatement *attribute_statement;
LassoSaml2Attribute *attribute;
LassoSaml2AttributeValue *attribute_value;
LassoWsAddrEndpointReference *epr;
GList *i;
g_return_val_if_fail(LASSO_IS_SESSION(session), LASSO_PROFILE_ERROR_SESSION_NOT_FOUND);
assertion = LASSO_SAML2_ASSERTION(
LASSO_SAMLP2_RESPONSE(profile->response)->Assertion->data);
for (i = g_list_first(assertion->AttributeStatement); i; i = g_list_next(i)) {
GList *j;
attribute_statement = LASSO_SAML2_ATTRIBUTE_STATEMENT(i->data);
if (attribute_statement == NULL) {
continue;
}
for (j = g_list_first(attribute_statement->Attribute); j; j = g_list_next(j)) {
GList *k;
attribute = LASSO_SAML2_ATTRIBUTE(j->data);
if (attribute == NULL || attribute->Name == NULL) {
continue;
}
if (strcmp(attribute->Name, LASSO_SAML2_ATTRIBUTE_NAME_EPR) != 0) {
continue;
}
for (k = g_list_first(attribute->AttributeValue); k; k = g_list_next(k)) {
GList *l;
attribute_value = LASSO_SAML2_ATTRIBUTE_VALUE(k->data);
if (attribute_value == NULL) {
continue;
}
for (l = g_list_first(attribute_value->any);
l; l = g_list_next(l)) {
if (LASSO_IS_WSA_ENDPOINT_REFERENCE(l->data)) {
epr = LASSO_WSA_ENDPOINT_REFERENCE(l->data);
lasso_session_add_endpoint_reference(session, epr);
return 0;
}
}
}
}
}
return 0;
}
#else
static gint
lasso_saml20_login_copy_assertion_epr(G_GNUC_UNUSED LassoLogin *login)
{
return LASSO_ERROR_UNIMPLEMENTED;
}
#endif
gint
lasso_saml20_login_accept_sso(LassoLogin *login)
@ -1467,7 +1281,9 @@ lasso_saml20_login_accept_sso(LassoLogin *login)
lasso_identity_add_federation(LASSO_PROFILE(login)->identity, federation);
}
#ifdef LASSO_WSF_ENABLED
lasso_saml20_login_copy_assertion_epr(login);
#endif
return 0;
}

View File

@ -29,7 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/login.h>
#include "../id-ff/login.h"
gint lasso_saml20_login_init_authn_request(LassoLogin *login, LassoHttpMethod http_method);
gint lasso_saml20_login_build_authn_request_msg(LassoLogin *login, LassoProvider *remote_provider);

View File

@ -23,24 +23,24 @@
*/
#include "../xml/private.h"
#include <lasso/saml-2.0/providerprivate.h>
#include <lasso/saml-2.0/logoutprivate.h>
#include <lasso/saml-2.0/profileprivate.h>
#include <lasso/saml-2.0/federationprivate.h>
#include "providerprivate.h"
#include "logoutprivate.h"
#include "profileprivate.h"
#include "federationprivate.h"
#include <lasso/id-ff/providerprivate.h>
#include <lasso/id-ff/logout.h>
#include <lasso/id-ff/logoutprivate.h>
#include <lasso/id-ff/identityprivate.h>
#include <lasso/id-ff/sessionprivate.h>
#include <lasso/id-ff/profileprivate.h>
#include <lasso/id-ff/serverprivate.h>
#include "../id-ff/providerprivate.h"
#include "../id-ff/logout.h"
#include "../id-ff/logoutprivate.h"
#include "../id-ff/identityprivate.h"
#include "../id-ff/sessionprivate.h"
#include "../id-ff/profileprivate.h"
#include "../id-ff/serverprivate.h"
#include <lasso/xml/xml_enc.h>
#include "../xml/xml_enc.h"
#include <lasso/xml/saml-2.0/samlp2_logout_request.h>
#include <lasso/xml/saml-2.0/samlp2_logout_response.h>
#include <lasso/xml/saml-2.0/saml2_assertion.h>
#include "../xml/saml-2.0/samlp2_logout_request.h"
#include "../xml/saml-2.0/samlp2_logout_response.h"
#include "../xml/saml-2.0/saml2_assertion.h"
#include "../utils.h"
static void check_soap_support(gchar *key, LassoProvider *provider, LassoProfile *profile);

View File

@ -29,7 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/logout.h>
#include "../id-ff/logout.h"
int lasso_saml20_logout_init_request(LassoLogout *logout,
LassoProvider *remote_provider, LassoHttpMethod http_method);

View File

@ -23,17 +23,17 @@
*/
#include "../xml/private.h"
#include <../saml-2.0/name_id_management.h>
#include <../saml-2.0/providerprivate.h>
#include <../saml-2.0/profileprivate.h>
#include <../saml-2.0/serverprivate.h>
#include <../id-ff/providerprivate.h>
#include <../id-ff/profileprivate.h>
#include <../id-ff/identityprivate.h>
#include <../id-ff/serverprivate.h>
#include <../xml/xml_enc.h>
#include "name_id_management.h"
#include "providerprivate.h"
#include "profileprivate.h"
#include "serverprivate.h"
#include "../id-ff/providerprivate.h"
#include "../id-ff/profileprivate.h"
#include "../id-ff/identityprivate.h"
#include "../id-ff/serverprivate.h"
#include "../xml/xml_enc.h"
#include "../utils.h"
#include <../xml/saml-2.0/samlp2_manage_name_id_request.h>
#include "../xml/saml-2.0/samlp2_manage_name_id_request.h"
/**
* SECTION:name_id_management

View File

@ -29,9 +29,9 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/profile.h>
#include <lasso/xml/saml-2.0/samlp2_manage_name_id_request.h>
#include <lasso/xml/saml-2.0/samlp2_manage_name_id_response.h>
#include "../id-ff/profile.h"
#include "../xml/saml-2.0/samlp2_manage_name_id_request.h"
#include "../xml/saml-2.0/samlp2_manage_name_id_response.h"
#define LASSO_TYPE_NAME_ID_MANAGEMENT (lasso_name_id_management_get_type())
#define LASSO_NAME_ID_MANAGEMENT(obj) \

View File

@ -26,24 +26,24 @@
#include <xmlsec/base64.h>
#include "../utils.h"
#include <lasso/saml-2.0/providerprivate.h>
#include <lasso/saml-2.0/profileprivate.h>
#include <lasso/saml-2.0/profile.h>
#include "providerprivate.h"
#include "profileprivate.h"
#include "profile.h"
#include <lasso/id-ff/providerprivate.h>
#include <lasso/id-ff/profile.h>
#include <lasso/id-ff/profileprivate.h>
#include <lasso/id-ff/serverprivate.h>
#include "../id-ff/providerprivate.h"
#include "../id-ff/profile.h"
#include "../id-ff/profileprivate.h"
#include "../id-ff/serverprivate.h"
#include <../id-ff/sessionprivate.h>
#include <lasso/xml/private.h>
#include <lasso/xml/saml-2.0/samlp2_request_abstract.h>
#include <lasso/xml/saml-2.0/samlp2_artifact_resolve.h>
#include <lasso/xml/saml-2.0/samlp2_artifact_response.h>
#include <lasso/xml/saml-2.0/samlp2_name_id_mapping_response.h>
#include <lasso/xml/saml-2.0/samlp2_status_response.h>
#include <lasso/xml/saml-2.0/samlp2_response.h>
#include <lasso/xml/saml-2.0/saml2_assertion.h>
#include "../xml/private.h"
#include "../xml/saml-2.0/samlp2_request_abstract.h"
#include "../xml/saml-2.0/samlp2_artifact_resolve.h"
#include "../xml/saml-2.0/samlp2_artifact_response.h"
#include "../xml/saml-2.0/samlp2_name_id_mapping_response.h"
#include "../xml/saml-2.0/samlp2_status_response.h"
#include "../xml/saml-2.0/samlp2_response.h"
#include "../xml/saml-2.0/saml2_assertion.h"
#include "../utils.h"
#include "../debug.h"

View File

@ -29,9 +29,9 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/id-ff/profile.h>
#include <lasso/xml/saml-2.0/saml2_name_id.h>
#include <lasso/xml/saml-2.0/saml2_encrypted_element.h>
#include "../id-ff/profile.h"
#include "../xml/saml-2.0/saml2_name_id.h"
#include "../xml/saml-2.0/saml2_encrypted_element.h"
#include "../xml/saml-2.0/samlp2_status_response.h"
#include "../xml/saml-2.0/samlp2_request_abstract.h"
#include "../id-ff/provider.h"

View File

@ -25,8 +25,8 @@
#include "../xml/private.h"
#include <xmlsec/base64.h>
#include <lasso/saml-2.0/providerprivate.h>
#include <lasso/id-ff/providerprivate.h>
#include "providerprivate.h"
#include "../id-ff/providerprivate.h"
#include "../utils.h"
const char *profile_names[] = {

View File

@ -29,8 +29,8 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/id-ff/provider.h>
#include "../xml/xml.h"
#include "../id-ff/provider.h"
gboolean lasso_saml20_provider_load_metadata(LassoProvider *provider, xmlNode *root_node);

View File

@ -23,9 +23,9 @@
*/
#include "../xml/private.h"
#include <lasso/saml-2.0/serverprivate.h>
#include <lasso/id-ff/serverprivate.h>
#include <lasso/id-ff/providerprivate.h>
#include "serverprivate.h"
#include "../id-ff/serverprivate.h"
#include "../id-ff/providerprivate.h"
int

View File

@ -29,8 +29,8 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/id-ff/server.h>
#include "../xml/xml.h"
#include "../id-ff/server.h"
int lasso_saml20_server_load_affiliation(LassoServer *server, xmlNode *node);

View File

@ -23,7 +23,7 @@
*/
#include "private.h"
#include <lasso/xml/disco_authenticate_requester.h>
#include "disco_authenticate_requester.h"
/**
* SECTION:disco_authenticate_requester

View File

@ -29,7 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include "xml.h"
#define LASSO_TYPE_DISCO_AUTHENTICATE_REQUESTER (lasso_disco_authenticate_requester_get_type())
#define LASSO_DISCO_AUTHENTICATE_REQUESTER(obj) \

View File

@ -23,7 +23,7 @@
*/
#include "private.h"
#include <lasso/xml/disco_authenticate_session_context.h>
#include "disco_authenticate_session_context.h"
/**
* SECTION:disco_authenticate_session_context

View File

@ -29,7 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include "xml.h"
#define LASSO_TYPE_DISCO_AUTHENTICATE_SESSION_CONTEXT \
(lasso_disco_authenticate_session_context_get_type())

View File

@ -23,7 +23,7 @@
*/
#include "private.h"
#include <lasso/xml/disco_authorize_requester.h>
#include "disco_authorize_requester.h"
/**
* SECTION:disco_authorize_requester

View File

@ -29,7 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include "xml.h"
#define LASSO_TYPE_DISCO_AUTHORIZE_REQUESTER (lasso_disco_authorize_requester_get_type())
#define LASSO_DISCO_AUTHORIZE_REQUESTER(obj) \

View File

@ -23,7 +23,7 @@
*/
#include "private.h"
#include <lasso/xml/disco_credentials.h>
#include "disco_credentials.h"
/**
* SECTION:disco_credentials

View File

@ -29,7 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include "xml.h"
#define LASSO_TYPE_DISCO_CREDENTIALS (lasso_disco_credentials_get_type())
#define LASSO_DISCO_CREDENTIALS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \

View File

@ -23,9 +23,9 @@
*/
#include "private.h"
#include <lasso/xml/disco_description.h>
#include <lasso/id-wsf/utils.h>
#include <lasso/utils.h>
#include "disco_description.h"
#include "../id-wsf/utils.h"
#include "..//utils.h"
/**
* SECTION:disco_description

View File

@ -29,7 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include "xml.h"
#define LASSO_TYPE_DISCO_DESCRIPTION (lasso_disco_description_get_type())
#define LASSO_DISCO_DESCRIPTION(obj) \

View File

@ -23,7 +23,7 @@
*/
#include "private.h"
#include <lasso/xml/disco_encrypt_resource_id.h>
#include "disco_encrypt_resource_id.h"
/**
* SECTION:disco_encrypt_resource_id

View File

@ -29,7 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include "xml.h"
#define LASSO_TYPE_DISCO_ENCRYPT_RESOURCE_ID (lasso_disco_encrypt_resource_id_get_type())
#define LASSO_DISCO_ENCRYPT_RESOURCE_ID(obj) \

View File

@ -23,7 +23,7 @@
*/
#include "private.h"
#include <lasso/xml/disco_encrypted_resource_id.h>
#include "disco_encrypted_resource_id.h"
/**
* SECTION:disco_encrypted_resource_id

View File

@ -29,7 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include "xml.h"
#define LASSO_TYPE_DISCO_ENCRYPTED_RESOURCE_ID (lasso_disco_encrypted_resource_id_get_type())
#define LASSO_DISCO_ENCRYPTED_RESOURCE_ID(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \

View File

@ -23,7 +23,7 @@
*/
#include "private.h"
#include <lasso/xml/disco_generate_bearer_token.h>
#include "disco_generate_bearer_token.h"
/**
* SECTION:disco_generate_bearer_token

View File

@ -29,7 +29,7 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include "xml.h"
#define LASSO_TYPE_DISCO_GENERATE_BEARER_TOKEN (lasso_disco_generate_bearer_token_get_type())
#define LASSO_DISCO_GENERATE_BEARER_TOKEN(obj) \

View File

@ -23,7 +23,7 @@
*/
#include "private.h"
#include <lasso/xml/disco_insert_entry.h>
#include "disco_insert_entry.h"
#include "../utils.h"
/**

View File

@ -29,8 +29,8 @@
extern "C" {
#endif /* __cplusplus */
#include <lasso/xml/xml.h>
#include <lasso/xml/disco_resource_offering.h>
#include "xml.h"
#include "disco_resource_offering.h"
#define LASSO_TYPE_DISCO_INSERT_ENTRY (lasso_disco_insert_entry_get_type())
#define LASSO_DISCO_INSERT_ENTRY(obj) \

View File

@ -23,7 +23,7 @@
*/
#include "private.h"
#include <lasso/xml/disco_modify.h>
#include "disco_modify.h"
/**
* SECTION:disco_modify

Some files were not shown because too many files have changed in this diff Show More