summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValery Febvre <vfebvre at easter-eggs.com>2004-07-29 23:33:53 +0000
committerValery Febvre <vfebvre at easter-eggs.com>2004-07-29 23:33:53 +0000
commit6b36c2b6d9ad12062a0ea98b16e41a68c86fc233 (patch)
tree0586b7370daeb8453ccfce036f9a452668533803
parent1489d3cd39f5836038cddf73a7404e444068ce81 (diff)
downloadlasso-6b36c2b6d9ad12062a0ea98b16e41a68c86fc233.tar.gz
lasso-6b36c2b6d9ad12062a0ea98b16e41a68c86fc233.tar.xz
lasso-6b36c2b6d9ad12062a0ea98b16e41a68c86fc233.zip
LassoProfileContext class was renamed into LassoProfile
-rw-r--r--lasso/id-ff/Makefile.am4
-rw-r--r--lasso/id-ff/federation_termination.c121
-rw-r--r--lasso/id-ff/federation_termination.h6
-rw-r--r--lasso/id-ff/login.c274
-rw-r--r--lasso/id-ff/login.h6
-rw-r--r--lasso/id-ff/logout.c216
-rw-r--r--lasso/id-ff/logout.h6
-rw-r--r--lasso/id-ff/name_identifier_mapping.c126
-rw-r--r--lasso/id-ff/name_identifier_mapping.h6
-rw-r--r--lasso/id-ff/profile.c (renamed from lasso/id-ff/profile_context.c)134
-rw-r--r--lasso/id-ff/profile.h144
-rw-r--r--lasso/id-ff/profile_context.h144
-rw-r--r--lasso/id-ff/register_name_identifier.c168
-rw-r--r--lasso/id-ff/register_name_identifier.h6
14 files changed, 688 insertions, 673 deletions
diff --git a/lasso/id-ff/Makefile.am b/lasso/id-ff/Makefile.am
index f8ddf94e..d2a972c5 100644
--- a/lasso/id-ff/Makefile.am
+++ b/lasso/id-ff/Makefile.am
@@ -18,7 +18,7 @@ liblasso_environs_la_SOURCES = \
login.c \
logout.c \
name_identifier_mapping.c \
- profile_context.c \
+ profile.c \
register_name_identifier.c \
server.c \
session.c
@@ -30,7 +30,7 @@ liblassoinclude_HEADERS = \
login.h \
logout.h \
name_identifier_mapping.h \
- profile_context.h \
+ profile.h \
register_name_identifier.h \
server.h \
session.h
diff --git a/lasso/id-ff/federation_termination.c b/lasso/id-ff/federation_termination.c
index 55253882..531ce9a9 100644
--- a/lasso/id-ff/federation_termination.c
+++ b/lasso/id-ff/federation_termination.c
@@ -32,42 +32,44 @@
gint
lasso_federation_termination_build_notification_msg(LassoFederationTermination *defederation)
{
- LassoProfileContext *profileContext;
- LassoProvider *provider;
- xmlChar *protocolProfile;
+ LassoProfile *profile;
+ LassoProvider *provider;
+ xmlChar *protocolProfile;
g_return_val_if_fail(LASSO_IS_FEDERATION_TERMINATION(defederation), -1);
- profileContext = LASSO_PROFILE_CONTEXT(defederation);
+ profile = LASSO_PROFILE(defederation);
- provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID);
- if(provider==NULL){
- message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profileContext->remote_providerID);
+ provider = lasso_server_get_provider(profile->server, profile->remote_providerID);
+ if(provider == NULL) {
+ message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profile->remote_providerID);
return(-2);
}
/* get the prototocol profile of the federation termination notification */
protocolProfile = lasso_provider_get_federationTerminationNotificationProtocolProfile(provider);
- if(protocolProfile==NULL){
+ if(protocolProfile == NULL) {
message(G_LOG_LEVEL_ERROR, "Federation termination notification protocol profile not found\n");
return(-3);
}
- if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){
- profileContext->request_type = lassoHttpMethodSoap;
- profileContext->msg_url = lasso_provider_get_federationTerminationServiceURL(provider);
- if(profileContext->msg_url==NULL){
+ if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \
+ xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)) {
+ profile->request_type = lassoHttpMethodSoap;
+ profile->msg_url = lasso_provider_get_federationTerminationServiceURL(provider);
+ if(profile->msg_url == NULL) {
message(G_LOG_LEVEL_ERROR, "Federation Termination Notification url not found\n");
return(-4);
}
- profileContext->msg_body = lasso_node_export_to_soap(profileContext->request);
+ profile->msg_body = lasso_node_export_to_soap(profile->request);
}
- else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){
- profileContext->request_type = lassoHttpMethodRedirect;
- profileContext->msg_url = lasso_node_export_to_query(profileContext->request,
- profileContext->server->signature_method,
- profileContext->server->private_key);
- profileContext->msg_body = NULL;
+ else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp) || \
+ xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)) {
+ profile->request_type = lassoHttpMethodRedirect;
+ profile->msg_url = lasso_node_export_to_query(profile->request,
+ profile->server->signature_method,
+ profile->server->private_key);
+ profile->msg_body = NULL;
}
else{
message(G_LOG_LEVEL_ERROR, "Invalid protocol profile\n");
@@ -87,7 +89,7 @@ gint
lasso_federation_termination_init_notification(LassoFederationTermination *defederation,
gchar *remote_providerID)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoFederation *federation;
LassoNode *nameIdentifier = NULL;
@@ -97,50 +99,51 @@ lasso_federation_termination_init_notification(LassoFederationTermination *defed
g_return_val_if_fail(LASSO_IS_FEDERATION_TERMINATION(defederation), -1);
- profileContext = LASSO_PROFILE_CONTEXT(defederation);
+ profile = LASSO_PROFILE(defederation);
if (remote_providerID == NULL) {
message(G_LOG_LEVEL_INFO, "No remote provider id, get the remote provider id of the first federation\n");
- profileContext->remote_providerID = lasso_identity_get_next_federation_remote_providerID(profileContext->identity);
+ profile->remote_providerID = lasso_identity_get_next_federation_remote_providerID(profile->identity);
}
else {
message(G_LOG_LEVEL_INFO, "A remote provider id for defederation notification : %s\n", remote_providerID);
- profileContext->remote_providerID = g_strdup(remote_providerID);
+ profile->remote_providerID = g_strdup(remote_providerID);
}
- if (profileContext->remote_providerID == NULL) {
+ if (profile->remote_providerID == NULL) {
message(G_LOG_LEVEL_ERROR, "No provider Id for init notification\n");
codeError = -1;
goto done;
}
/* get federation */
- federation = lasso_identity_get_federation(profileContext->identity, profileContext->remote_providerID);
+ federation = lasso_identity_get_federation(profile->identity, profile->remote_providerID);
if (federation == NULL) {
- message(G_LOG_LEVEL_ERROR, "Federation not found for %s\n", profileContext->remote_providerID);
+ message(G_LOG_LEVEL_ERROR, "Federation not found for %s\n", profile->remote_providerID);
codeError = -1;
goto done;
}
/* get the name identifier (!!! depend on the provider type : SP or IDP !!!)*/
- switch(profileContext->provider_type){
+ switch(profile->provider_type) {
case lassoProviderTypeSp:
nameIdentifier = LASSO_NODE(lasso_federation_get_local_nameIdentifier(federation));
- if(!nameIdentifier){
+ if(!nameIdentifier) {
nameIdentifier = LASSO_NODE(lasso_federation_get_remote_nameIdentifier(federation));
}
break;
case lassoProviderTypeIdp:
nameIdentifier = LASSO_NODE(lasso_federation_get_remote_nameIdentifier(federation));
- if(!nameIdentifier)
+ if(!nameIdentifier) {
nameIdentifier = LASSO_NODE(lasso_federation_get_local_nameIdentifier(federation));
+ }
break;
default:
message(G_LOG_LEVEL_ERROR, "Invalid provider type\n");
}
- if(!nameIdentifier){
- message(G_LOG_LEVEL_ERROR, "Name identifier not found for %s\n", profileContext->remote_providerID);
+ if(!nameIdentifier) {
+ message(G_LOG_LEVEL_ERROR, "Name identifier not found for %s\n", profile->remote_providerID);
codeError = -1;
goto done;
}
@@ -149,12 +152,12 @@ lasso_federation_termination_init_notification(LassoFederationTermination *defed
content = lasso_node_get_content(nameIdentifier);
nameQualifier = lasso_node_get_attr_value(nameIdentifier, "NameQualifier", NULL);
format = lasso_node_get_attr_value(nameIdentifier, "Format", NULL);
- profileContext->request = lasso_federation_termination_notification_new(profileContext->server->providerID,
- content,
- nameQualifier,
- format);
+ profile->request = lasso_federation_termination_notification_new(profile->server->providerID,
+ content,
+ nameQualifier,
+ format);
- if(profileContext->request==NULL){
+ if(profile->request == NULL) {
message(G_LOG_LEVEL_ERROR, "Error while creating the notification\n");
codeError = -1;
goto done;
@@ -176,38 +179,38 @@ lasso_federation_termination_load_notification_msg(LassoFederationTermination *d
gchar *notification_msg,
lassoHttpMethods notification_method)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
g_return_val_if_fail(LASSO_IS_FEDERATION_TERMINATION(defederation), -1);
g_return_val_if_fail(notification_msg!=NULL, -2);
- profileContext = LASSO_PROFILE_CONTEXT(defederation);
+ profile = LASSO_PROFILE(defederation);
switch(notification_method){
case lassoHttpMethodSoap:
debug("Build a federation termination notification from soap msg\n");
- profileContext->request = lasso_federation_termination_notification_new_from_export(notification_msg, lassoNodeExportTypeSoap);
+ profile->request = lasso_federation_termination_notification_new_from_export(notification_msg, lassoNodeExportTypeSoap);
break;
case lassoHttpMethodRedirect:
debug("Build a federation termination notification from query msg\n");
- profileContext->request = lasso_federation_termination_notification_new_from_export(notification_msg, lassoNodeExportTypeQuery);
+ profile->request = lasso_federation_termination_notification_new_from_export(notification_msg, lassoNodeExportTypeQuery);
break;
default:
message(G_LOG_LEVEL_ERROR, "Invalid notification method\n");
return(-3);
}
- if(profileContext->request==NULL){
+ if(profile->request==NULL){
message(G_LOG_LEVEL_ERROR, "Error while building the notification from msg\n");
return(-4);
}
/* get the NameIdentifier to load identity dump */
- profileContext->nameIdentifier = lasso_node_get_child_content(profileContext->request,
- "NameIdentifier", NULL);
-
+ profile->nameIdentifier = lasso_node_get_child_content(profile->request,
+ "NameIdentifier", NULL);
+
/* get the RelayState */
- profileContext->msg_relayState = lasso_node_get_child_content(profileContext->request,
- "RelayState", NULL);
+ profile->msg_relayState = lasso_node_get_child_content(profile->request,
+ "RelayState", NULL);
return(0);
}
@@ -215,49 +218,49 @@ lasso_federation_termination_load_notification_msg(LassoFederationTermination *d
gint
lasso_federation_termination_process_notification(LassoFederationTermination *defederation)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoFederation *federation;
LassoNode *nameIdentifier;
- profileContext = LASSO_PROFILE_CONTEXT(defederation);
+ profile = LASSO_PROFILE(defederation);
- if(profileContext->request==NULL){
+ if(profile->request == NULL){
message(G_LOG_LEVEL_ERROR, "Request not found\n");
return(-1);
}
/* set the remote provider id from the request */
- profileContext->remote_providerID = lasso_node_get_child_content(profileContext->request, "ProviderID", NULL);
- if(profileContext->remote_providerID==NULL){
+ profile->remote_providerID = lasso_node_get_child_content(profile->request, "ProviderID", NULL);
+ if(profile->remote_providerID == NULL) {
message(G_LOG_LEVEL_ERROR, "Remote provider id not found\n");
return(-1);
}
- nameIdentifier = lasso_node_get_child(profileContext->request, "NameIdentifier", NULL);
- if(nameIdentifier==NULL){
+ nameIdentifier = lasso_node_get_child(profile->request, "NameIdentifier", NULL);
+ if(nameIdentifier == NULL) {
message(G_LOG_LEVEL_ERROR, "Name identifier not found in request\n");
return(-1);
}
/* Verify federation */
- if (profileContext->identity == NULL){
+ if (profile->identity == NULL) {
message(G_LOG_LEVEL_ERROR, "Identity environ not found\n");
return(-1);
}
- federation = lasso_identity_get_federation(profileContext->identity, profileContext->remote_providerID);
+ federation = lasso_identity_get_federation(profile->identity, profile->remote_providerID);
if (federation == NULL) {
- message(G_LOG_LEVEL_WARNING, "No federation for %s\n", profileContext->remote_providerID);
+ message(G_LOG_LEVEL_WARNING, "No federation for %s\n", profile->remote_providerID);
return(-1);
}
if (lasso_federation_verify_nameIdentifier(federation, nameIdentifier) == FALSE) {
- message(G_LOG_LEVEL_WARNING, "No name identifier for %s\n", profileContext->remote_providerID);
+ message(G_LOG_LEVEL_WARNING, "No name identifier for %s\n", profile->remote_providerID);
return(-1);
}
/* remove federation of the remote provider */
- lasso_identity_remove_federation(profileContext->identity, profileContext->remote_providerID);
+ lasso_identity_remove_federation(profile->identity, profile->remote_providerID);
return(0);
}
@@ -292,7 +295,7 @@ GType lasso_federation_termination_get_type() {
(GInstanceInitFunc) lasso_federation_termination_instance_init,
};
- this_type = g_type_register_static(LASSO_TYPE_PROFILE_CONTEXT,
+ this_type = g_type_register_static(LASSO_TYPE_PROFILE,
"LassoFederationTermination",
&this_info, 0);
}
diff --git a/lasso/id-ff/federation_termination.h b/lasso/id-ff/federation_termination.h
index 9bd7b4ae..f524ce82 100644
--- a/lasso/id-ff/federation_termination.h
+++ b/lasso/id-ff/federation_termination.h
@@ -30,7 +30,7 @@
extern "C" {
#endif /* __cplusplus */
-#include <lasso/environs/profile_context.h>
+#include <lasso/environs/profile.h>
#include <lasso/protocols/federation_termination_notification.h>
#define LASSO_TYPE_FEDERATION_TERMINATION (lasso_federation_termination_get_type())
@@ -44,13 +44,13 @@ typedef struct _LassoFederationTermination LassoFederationTermination;
typedef struct _LassoFederationTerminationClass LassoFederationTerminationClass;
struct _LassoFederationTermination {
- LassoProfileContext parent;
+ LassoProfile parent;
/*< private >*/
};
struct _LassoFederationTerminationClass {
- LassoNodeClass parent;
+ LassoProfileClass parent;
};
diff --git a/lasso/id-ff/login.c b/lasso/id-ff/login.c
index 3abb1f3e..6cb1a76c 100644
--- a/lasso/id-ff/login.c
+++ b/lasso/id-ff/login.c
@@ -81,7 +81,7 @@ lasso_login_add_response_assertion(LassoLogin *login,
GError *err = NULL;
gint ret = 0;
- requestID = lasso_node_get_attr_value(LASSO_NODE(LASSO_PROFILE_CONTEXT(login)->request),
+ requestID = lasso_node_get_attr_value(LASSO_NODE(LASSO_PROFILE(login)->request),
"RequestID", &err);
if (requestID == NULL) {
@@ -91,7 +91,7 @@ lasso_login_add_response_assertion(LassoLogin *login,
return(ret);
}
- assertion = lasso_assertion_new(LASSO_PROFILE_CONTEXT(login)->server->providerID,
+ assertion = lasso_assertion_new(LASSO_PROFILE(login)->server->providerID,
requestID);
xmlFree(requestID);
authentication_statement = lasso_authentication_statement_new(authenticationMethod,
@@ -108,22 +108,22 @@ lasso_login_add_response_assertion(LassoLogin *login,
return(-3);
}
/* store NameIdentifier */
- LASSO_PROFILE_CONTEXT(login)->nameIdentifier = lasso_login_get_assertion_nameIdentifier(assertion);
+ LASSO_PROFILE(login)->nameIdentifier = lasso_login_get_assertion_nameIdentifier(assertion);
ret = lasso_saml_assertion_set_signature(LASSO_SAML_ASSERTION(assertion),
- LASSO_PROFILE_CONTEXT(login)->server->signature_method,
- LASSO_PROFILE_CONTEXT(login)->server->private_key,
- LASSO_PROFILE_CONTEXT(login)->server->certificate);
+ LASSO_PROFILE(login)->server->signature_method,
+ LASSO_PROFILE(login)->server->private_key,
+ LASSO_PROFILE(login)->server->certificate);
if (ret == 0) {
- lasso_samlp_response_add_assertion(LASSO_SAMLP_RESPONSE(LASSO_PROFILE_CONTEXT(login)->response),
+ lasso_samlp_response_add_assertion(LASSO_SAMLP_RESPONSE(LASSO_PROFILE(login)->response),
assertion);
/* store assertion in session object */
- if (LASSO_PROFILE_CONTEXT(login)->session == NULL) {
- LASSO_PROFILE_CONTEXT(login)->session = lasso_session_new();
+ if (LASSO_PROFILE(login)->session == NULL) {
+ LASSO_PROFILE(login)->session = lasso_session_new();
}
- lasso_session_add_assertion(LASSO_PROFILE_CONTEXT(login)->session,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID,
+ lasso_session_add_assertion(LASSO_PROFILE(login)->session,
+ LASSO_PROFILE(login)->remote_providerID,
assertion);
}
@@ -143,16 +143,16 @@ lasso_login_process_federation(LassoLogin *login)
GError *err = NULL;
/* verify if a identity exists else create it */
- if (LASSO_PROFILE_CONTEXT(login)->identity == NULL) {
- LASSO_PROFILE_CONTEXT(login)->identity = lasso_identity_new();
+ if (LASSO_PROFILE(login)->identity == NULL) {
+ LASSO_PROFILE(login)->identity = lasso_identity_new();
}
- federation = lasso_identity_get_federation(LASSO_PROFILE_CONTEXT(login)->identity,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID);
- nameIDPolicy = lasso_node_get_child_content(LASSO_PROFILE_CONTEXT(login)->request,
+ federation = lasso_identity_get_federation(LASSO_PROFILE(login)->identity,
+ LASSO_PROFILE(login)->remote_providerID);
+ nameIDPolicy = lasso_node_get_child_content(LASSO_PROFILE(login)->request,
"NameIDPolicy", NULL);
if (nameIDPolicy == NULL || xmlStrEqual(nameIDPolicy, lassoLibNameIDPolicyTypeNone)) {
if (federation == NULL) {
- lasso_profile_context_set_response_status(LASSO_PROFILE_CONTEXT(login),
+ lasso_profile_set_response_status(LASSO_PROFILE(login),
lassoLibStatusCodeFederationDoesNotExist);
ret = -2;
goto done;
@@ -160,11 +160,11 @@ lasso_login_process_federation(LassoLogin *login)
}
else if (xmlStrEqual(nameIDPolicy, lassoLibNameIDPolicyTypeFederated)) {
debug("NameIDPolicy is federated\n");
- consent = lasso_node_get_attr_value(LASSO_PROFILE_CONTEXT(login)->request,
+ consent = lasso_node_get_attr_value(LASSO_PROFILE(login)->request,
"consent", &err);
if (consent != NULL) {
if (!xmlStrEqual(consent, lassoLibConsentObtained)) {
- lasso_profile_context_set_response_status(LASSO_PROFILE_CONTEXT(login),
+ lasso_profile_set_response_status(LASSO_PROFILE(login),
lassoSamlStatusCodeRequestDenied);
message(G_LOG_LEVEL_WARNING, "Consent not obtained");
ret = -3;
@@ -172,7 +172,7 @@ lasso_login_process_federation(LassoLogin *login)
}
}
else {
- lasso_profile_context_set_response_status(LASSO_PROFILE_CONTEXT(login),
+ lasso_profile_set_response_status(LASSO_PROFILE(login),
lassoSamlStatusCodeRequestDenied);
message(G_LOG_LEVEL_WARNING, err->message);
ret = err->code;
@@ -180,21 +180,21 @@ lasso_login_process_federation(LassoLogin *login)
goto done;
}
if (federation == NULL) {
- federation = lasso_federation_new(LASSO_PROFILE_CONTEXT(login)->remote_providerID);
+ federation = lasso_federation_new(LASSO_PROFILE(login)->remote_providerID);
/* set local NameIdentifier in federation */
id = lasso_build_unique_id(32);
nameIdentifier = lasso_saml_name_identifier_new(id);
xmlFree(id);
lasso_saml_name_identifier_set_nameQualifier(LASSO_SAML_NAME_IDENTIFIER(nameIdentifier),
- LASSO_PROFILE_CONTEXT(login)->server->providerID);
+ LASSO_PROFILE(login)->server->providerID);
lasso_saml_name_identifier_set_format(LASSO_SAML_NAME_IDENTIFIER(nameIdentifier),
lassoLibNameIdentifierFormatFederated);
lasso_federation_set_local_nameIdentifier(federation, nameIdentifier);
lasso_node_destroy(nameIdentifier);
- lasso_identity_add_federation(LASSO_PROFILE_CONTEXT(login)->identity,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID,
+ lasso_identity_add_federation(LASSO_PROFILE(login)->identity,
+ LASSO_PROFILE(login)->remote_providerID,
federation);
}
else {
@@ -221,11 +221,11 @@ lasso_login_process_response_status_and_assertion(LassoLogin *login) {
gint ret = 0;
GError *err = NULL;
- assertion = lasso_node_get_child(LASSO_PROFILE_CONTEXT(login)->response,
+ assertion = lasso_node_get_child(LASSO_PROFILE(login)->response,
"Assertion",
lassoLibHRef);
- idp = lasso_server_get_provider(LASSO_PROFILE_CONTEXT(login)->server,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID);
+ idp = lasso_server_get_provider(LASSO_PROFILE(login)->server,
+ LASSO_PROFILE(login)->remote_providerID);
if (assertion != NULL) {
/* verify signature */
@@ -239,8 +239,8 @@ lasso_login_process_response_status_and_assertion(LassoLogin *login) {
}
/* store NameIdentifier */
- LASSO_PROFILE_CONTEXT(login)->nameIdentifier = lasso_login_get_assertion_nameIdentifier(assertion);
- if (LASSO_PROFILE_CONTEXT(login)->nameIdentifier == NULL) {
+ LASSO_PROFILE(login)->nameIdentifier = lasso_login_get_assertion_nameIdentifier(assertion);
+ if (LASSO_PROFILE(login)->nameIdentifier == NULL) {
message(G_LOG_LEVEL_ERROR, "NameIdentifier element not found in Assertion.\n");
ret = -4;
goto done;
@@ -248,7 +248,7 @@ lasso_login_process_response_status_and_assertion(LassoLogin *login) {
}
/* check StatusCode value */
- status = lasso_node_get_child(LASSO_PROFILE_CONTEXT(login)->response,
+ status = lasso_node_get_child(LASSO_PROFILE(login)->response,
"Status", lassoSamlProtocolHRef);
if (status == NULL) {
message(G_LOG_LEVEL_ERROR, "Status element not found in response.\n");
@@ -315,14 +315,14 @@ lasso_login_build_artifact_msg(LassoLogin *login,
}
if (authentication_result == 0) {
- lasso_profile_context_set_response_status(LASSO_PROFILE_CONTEXT(login),
+ lasso_profile_set_response_status(LASSO_PROFILE(login),
lassoSamlStatusCodeRequestDenied);
}
else {
/* federation */
lasso_login_process_federation(login);
- federation = lasso_identity_get_federation(LASSO_PROFILE_CONTEXT(login)->identity,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID);
+ federation = lasso_identity_get_federation(LASSO_PROFILE(login)->identity,
+ LASSO_PROFILE(login)->remote_providerID);
/* fill the response with the assertion */
if (federation != NULL) {
lasso_login_add_response_assertion(login,
@@ -332,39 +332,39 @@ lasso_login_build_artifact_msg(LassoLogin *login,
}
}
/* save response dump */
- login->response_dump = lasso_node_export_to_soap(LASSO_PROFILE_CONTEXT(login)->response);
+ login->response_dump = lasso_node_export_to_soap(LASSO_PROFILE(login)->response);
/* build artifact infos */
- remote_provider = lasso_server_get_provider(LASSO_PROFILE_CONTEXT(login)->server,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID);
+ remote_provider = lasso_server_get_provider(LASSO_PROFILE(login)->server,
+ LASSO_PROFILE(login)->remote_providerID);
/* liberty-idff-bindings-profiles-v1.2.pdf p.25 */
url = lasso_provider_get_assertionConsumerServiceURL(remote_provider);
samlArt = g_new(gchar, 2+20+20+1);
- identityProviderSuccinctID = lasso_str_hash(LASSO_PROFILE_CONTEXT(login)->server->providerID,
- LASSO_PROFILE_CONTEXT(login)->server->private_key);
+ identityProviderSuccinctID = lasso_str_hash(LASSO_PROFILE(login)->server->providerID,
+ LASSO_PROFILE(login)->server->private_key);
assertionHandle = lasso_build_random_sequence(20);
g_sprintf(samlArt, "%c%c%s%s", 0, 3, identityProviderSuccinctID, assertionHandle);
g_free(assertionHandle);
xmlFree(identityProviderSuccinctID);
b64_samlArt = (gchar *)xmlSecBase64Encode(samlArt, 42, 0);
g_free(samlArt);
- relayState = lasso_node_get_child_content(LASSO_PROFILE_CONTEXT(login)->request,
+ relayState = lasso_node_get_child_content(LASSO_PROFILE(login)->request,
"RelayState", NULL);
switch (method) {
case lassoHttpMethodRedirect:
- LASSO_PROFILE_CONTEXT(login)->msg_url = g_new(gchar, 1024+1);
- g_sprintf(LASSO_PROFILE_CONTEXT(login)->msg_url, "%s?SAMLArt=%s", url, b64_samlArt);
+ LASSO_PROFILE(login)->msg_url = g_new(gchar, 1024+1);
+ g_sprintf(LASSO_PROFILE(login)->msg_url, "%s?SAMLArt=%s", url, b64_samlArt);
if (relayState != NULL) {
- g_sprintf(LASSO_PROFILE_CONTEXT(login)->msg_url, "%s&RelayState=%s",
- LASSO_PROFILE_CONTEXT(login)->msg_url, relayState);
+ g_sprintf(LASSO_PROFILE(login)->msg_url, "%s&RelayState=%s",
+ LASSO_PROFILE(login)->msg_url, relayState);
}
break;
case lassoHttpMethodPost:
- LASSO_PROFILE_CONTEXT(login)->msg_url = g_strdup(url);
- LASSO_PROFILE_CONTEXT(login)->msg_body = g_strdup(b64_samlArt);
+ LASSO_PROFILE(login)->msg_url = g_strdup(url);
+ LASSO_PROFILE(login)->msg_body = g_strdup(b64_samlArt);
if (relayState != NULL) {
- LASSO_PROFILE_CONTEXT(login)->msg_relayState = g_strdup(relayState);
+ LASSO_PROFILE(login)->msg_relayState = g_strdup(relayState);
}
break;
}
@@ -388,9 +388,9 @@ lasso_login_build_authn_request_msg(LassoLogin *login)
gboolean must_sign;
gint ret = 0;
- provider = LASSO_PROVIDER(LASSO_PROFILE_CONTEXT(login)->server);
- remote_provider = lasso_server_get_provider(LASSO_PROFILE_CONTEXT(login)->server,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID);
+ provider = LASSO_PROVIDER(LASSO_PROFILE(login)->server);
+ remote_provider = lasso_server_get_provider(LASSO_PROFILE(login)->server,
+ LASSO_PROFILE(login)->remote_providerID);
/* check if authnRequest must be signed */
md_authnRequestsSigned = lasso_node_get_child_content(provider->metadata, "AuthnRequestsSigned", NULL);
@@ -427,9 +427,9 @@ lasso_login_build_authn_request_msg(LassoLogin *login)
if (xmlStrEqual(request_protocolProfile, lassoLibProtocolProfileSSOGet)) {
/* GET -> query */
if (must_sign) {
- query = lasso_node_export_to_query(LASSO_PROFILE_CONTEXT(login)->request,
- LASSO_PROFILE_CONTEXT(login)->server->signature_method,
- LASSO_PROFILE_CONTEXT(login)->server->private_key);
+ query = lasso_node_export_to_query(LASSO_PROFILE(login)->request,
+ LASSO_PROFILE(login)->server->signature_method,
+ LASSO_PROFILE(login)->server->private_key);
if (query == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Failed to create AuthnRequest query (signed).\n");
ret = -4;
@@ -437,7 +437,7 @@ lasso_login_build_authn_request_msg(LassoLogin *login)
}
}
else {
- query = lasso_node_export_to_query(LASSO_PROFILE_CONTEXT(login)->request, 0, NULL);
+ query = lasso_node_export_to_query(LASSO_PROFILE(login)->request, 0, NULL);
if (query == NULL) {
message(G_LOG_LEVEL_CRITICAL, "Failed to create AuthnRequest query.\n");
ret = -4;
@@ -445,17 +445,17 @@ lasso_login_build_authn_request_msg(LassoLogin *login)
}
}
/* alloc msg_url (+2 for the ? and \0) */
- LASSO_PROFILE_CONTEXT(login)->msg_url = (gchar *) g_new(gchar, strlen(url) + strlen(query) + 2);
- g_sprintf(LASSO_PROFILE_CONTEXT(login)->msg_url, "%s?%s", url, query);
- LASSO_PROFILE_CONTEXT(login)->msg_body = NULL;
+ LASSO_PROFILE(login)->msg_url = (gchar *) g_new(gchar, strlen(url) + strlen(query) + 2);
+ g_sprintf(LASSO_PROFILE(login)->msg_url, "%s?%s", url, query);
+ LASSO_PROFILE(login)->msg_body = NULL;
g_free(query);
}
else if (xmlStrEqual(request_protocolProfile, lassoLibProtocolProfileSSOPost)) {
/* POST -> formular */
- lareq = lasso_node_export_to_base64(LASSO_PROFILE_CONTEXT(login)->request);
+ lareq = lasso_node_export_to_base64(LASSO_PROFILE(login)->request);
if (lareq != NULL) {
- LASSO_PROFILE_CONTEXT(login)->msg_url = g_strdup(url);
- LASSO_PROFILE_CONTEXT(login)->msg_body = lareq;
+ LASSO_PROFILE(login)->msg_url = g_strdup(url);
+ LASSO_PROFILE(login)->msg_body = lareq;
}
else {
message(G_LOG_LEVEL_CRITICAL, "Failed to export AuthnRequest (Base64 encoded).\n");
@@ -486,14 +486,14 @@ lasso_login_build_authn_response_msg(LassoLogin *login,
}
if (authentication_result == 0) {
- lasso_profile_context_set_response_status(LASSO_PROFILE_CONTEXT(login),
+ lasso_profile_set_response_status(LASSO_PROFILE(login),
lassoSamlStatusCodeRequestDenied);
}
else {
/* federation */
lasso_login_process_federation(login);
- federation = lasso_identity_get_federation(LASSO_PROFILE_CONTEXT(login)->identity,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID);
+ federation = lasso_identity_get_federation(LASSO_PROFILE(login)->identity,
+ LASSO_PROFILE(login)->remote_providerID);
/* fill the response with the assertion */
if (federation != NULL) {
lasso_login_add_response_assertion(login,
@@ -503,11 +503,11 @@ lasso_login_build_authn_response_msg(LassoLogin *login,
}
}
- remote_provider = lasso_server_get_provider(LASSO_PROFILE_CONTEXT(login)->server,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID);
+ remote_provider = lasso_server_get_provider(LASSO_PROFILE(login)->server,
+ LASSO_PROFILE(login)->remote_providerID);
/* return an authnResponse (base64 encoded) */
- LASSO_PROFILE_CONTEXT(login)->msg_body = lasso_node_export_to_base64(LASSO_PROFILE_CONTEXT(login)->response);
- LASSO_PROFILE_CONTEXT(login)->msg_url = lasso_provider_get_assertionConsumerServiceURL(remote_provider);
+ LASSO_PROFILE(login)->msg_body = lasso_node_export_to_base64(LASSO_PROFILE(login)->response);
+ LASSO_PROFILE(login)->msg_url = lasso_provider_get_assertionConsumerServiceURL(remote_provider);
return (0);
}
@@ -517,10 +517,10 @@ lasso_login_build_request_msg(LassoLogin *login)
{
LassoProvider *remote_provider;
- remote_provider = lasso_server_get_provider(LASSO_PROFILE_CONTEXT(login)->server,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID);
- LASSO_PROFILE_CONTEXT(login)->msg_body = lasso_node_export_to_soap(LASSO_PROFILE_CONTEXT(login)->request);
- LASSO_PROFILE_CONTEXT(login)->msg_url = lasso_provider_get_soapEndpoint(remote_provider);
+ remote_provider = lasso_server_get_provider(LASSO_PROFILE(login)->server,
+ LASSO_PROFILE(login)->remote_providerID);
+ LASSO_PROFILE(login)->msg_body = lasso_node_export_to_soap(LASSO_PROFILE(login)->request);
+ LASSO_PROFILE(login)->msg_url = lasso_provider_get_soapEndpoint(remote_provider);
return (0);
}
@@ -535,15 +535,15 @@ lasso_login_accept_sso(LassoLogin *login)
LassoFederation *federation = NULL;
gint ret = 0;
- if(LASSO_PROFILE_CONTEXT(login)->identity == NULL) {
- LASSO_PROFILE_CONTEXT(login)->identity = lasso_identity_new();
+ if(LASSO_PROFILE(login)->identity == NULL) {
+ LASSO_PROFILE(login)->identity = lasso_identity_new();
}
- if(LASSO_PROFILE_CONTEXT(login)->session == NULL) {
- LASSO_PROFILE_CONTEXT(login)->session = lasso_session_new();
+ if(LASSO_PROFILE(login)->session == NULL) {
+ LASSO_PROFILE(login)->session = lasso_session_new();
}
- if (LASSO_PROFILE_CONTEXT(login)->response != NULL) {
- assertion = lasso_node_get_child(LASSO_PROFILE_CONTEXT(login)->response,
+ if (LASSO_PROFILE(login)->response != NULL) {
+ assertion = lasso_node_get_child(LASSO_PROFILE(login)->response,
"Assertion", lassoLibHRef);
if (assertion == NULL) {
message(G_LOG_LEVEL_ERROR, "Assertion element not found in response.\n");
@@ -552,8 +552,8 @@ lasso_login_accept_sso(LassoLogin *login)
}
/* put response assertion in identity object */
- lasso_session_add_assertion(LASSO_PROFILE_CONTEXT(login)->session,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID,
+ lasso_session_add_assertion(LASSO_PROFILE(login)->session,
+ LASSO_PROFILE(login)->remote_providerID,
assertion);
/* put the 2 NameIdentifiers in identity object */
@@ -579,11 +579,11 @@ lasso_login_accept_sso(LassoLogin *login)
lassoSamlAssertionPrefix);
/* create federation */
- federation = lasso_federation_new(LASSO_PROFILE_CONTEXT(login)->remote_providerID);
+ federation = lasso_federation_new(LASSO_PROFILE(login)->remote_providerID);
lasso_federation_set_local_nameIdentifier(federation, nameIdentifier);
lasso_federation_set_remote_nameIdentifier(federation, copy_idpProvidedNameIdentifier);
- lasso_identity_add_federation(LASSO_PROFILE_CONTEXT(login)->identity,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID,
+ lasso_identity_add_federation(LASSO_PROFILE(login)->identity,
+ LASSO_PROFILE(login)->remote_providerID,
federation);
}
else {
@@ -611,7 +611,7 @@ lasso_login_dump(LassoLogin *login)
gchar *parent_dump, *dump;
gchar *protocolProfile = g_new0(gchar, 6);
- parent_dump = lasso_profile_context_dump(LASSO_PROFILE_CONTEXT(login), "LassoLogin");
+ parent_dump = lasso_profile_dump(LASSO_PROFILE(login), "LassoLogin");
node = lasso_node_new_from_dump(parent_dump);
g_free(parent_dump);
@@ -638,11 +638,11 @@ lasso_login_init_authn_request(LassoLogin *login,
{
g_return_val_if_fail(remote_providerID != NULL, -1);
- LASSO_PROFILE_CONTEXT(login)->request = lasso_authn_request_new(LASSO_PROFILE_CONTEXT(login)->server->providerID);
- LASSO_PROFILE_CONTEXT(login)->request_type = lassoMessageTypeAuthnRequest;
- LASSO_PROFILE_CONTEXT(login)->remote_providerID = g_strdup(remote_providerID);
+ LASSO_PROFILE(login)->request = lasso_authn_request_new(LASSO_PROFILE(login)->server->providerID);
+ LASSO_PROFILE(login)->request_type = lassoMessageTypeAuthnRequest;
+ LASSO_PROFILE(login)->remote_providerID = g_strdup(remote_providerID);
- if (LASSO_PROFILE_CONTEXT(login)->request == NULL) {
+ if (LASSO_PROFILE(login)->request == NULL) {
return (-2);
}
@@ -668,14 +668,14 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login,
return (-1);
}
- server = LASSO_PROFILE_CONTEXT(login)->server;
+ server = LASSO_PROFILE(login)->server;
/* rebuild request */
switch (authn_request_method) {
case lassoHttpMethodGet:
case lassoHttpMethodRedirect:
/* LibAuthnRequest send by method GET */
- LASSO_PROFILE_CONTEXT(login)->request = lasso_authn_request_new_from_export(authn_request_msg,
+ LASSO_PROFILE(login)->request = lasso_authn_request_new_from_export(authn_request_msg,
lassoNodeExportTypeQuery);
break;
case lassoHttpMethodPost:
@@ -683,10 +683,10 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login,
message(G_LOG_LEVEL_MESSAGE, "HTTP method POST isn't implemented yet.\n");
return (-2);
}
- LASSO_PROFILE_CONTEXT(login)->request_type = lassoMessageTypeAuthnRequest;
+ LASSO_PROFILE(login)->request_type = lassoMessageTypeAuthnRequest;
/* get ProtocolProfile */
- protocolProfile = lasso_node_get_child_content(LASSO_PROFILE_CONTEXT(login)->request,
+ protocolProfile = lasso_node_get_child_content(LASSO_PROFILE(login)->request,
"ProtocolProfile", NULL);
if (protocolProfile == NULL) {
login->protocolProfile = lassoLoginProtocolProfileBrwsArt;
@@ -703,23 +703,23 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login,
switch (login->protocolProfile) {
case lassoLoginProtocolProfileBrwsPost:
/* create LibAuthnResponse */
- LASSO_PROFILE_CONTEXT(login)->response = lasso_authn_response_new(LASSO_PROFILE_CONTEXT(login)->server->providerID,
- LASSO_PROFILE_CONTEXT(login)->request);
- LASSO_PROFILE_CONTEXT(login)->response_type = lassoMessageTypeAuthnResponse;
+ LASSO_PROFILE(login)->response = lasso_authn_response_new(LASSO_PROFILE(login)->server->providerID,
+ LASSO_PROFILE(login)->request);
+ LASSO_PROFILE(login)->response_type = lassoMessageTypeAuthnResponse;
break;
case lassoLoginProtocolProfileBrwsArt:
/* create SamlpResponse */
- LASSO_PROFILE_CONTEXT(login)->response = lasso_response_new();
- LASSO_PROFILE_CONTEXT(login)->response_type = lassoMessageTypeResponse;
+ LASSO_PROFILE(login)->response = lasso_response_new();
+ LASSO_PROFILE(login)->response_type = lassoMessageTypeResponse;
break;
}
/* get remote ProviderID */
- LASSO_PROFILE_CONTEXT(login)->remote_providerID = lasso_node_get_child_content(LASSO_PROFILE_CONTEXT(login)->request,
+ LASSO_PROFILE(login)->remote_providerID = lasso_node_get_child_content(LASSO_PROFILE(login)->request,
"ProviderID", NULL);
- remote_provider = lasso_server_get_provider(LASSO_PROFILE_CONTEXT(login)->server,
- LASSO_PROFILE_CONTEXT(login)->remote_providerID);
+ remote_provider = lasso_server_get_provider(LASSO_PROFILE(login)->server,
+ LASSO_PROFILE(login)->remote_providerID);
/* Is authnRequest signed ? */
md_authnRequestsSigned = lasso_node_get_child_content(remote_provider->metadata, "AuthnRequestsSigned", NULL);
if (md_authnRequestsSigned != NULL) {
@@ -739,10 +739,10 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login,
debug("Query signature has been verified\n");
signature_status = lasso_query_verify_signature(authn_request_msg,
remote_provider->public_key,
- LASSO_PROFILE_CONTEXT(login)->server->private_key);
+ LASSO_PROFILE(login)->server->private_key);
break;
case lassoHttpMethodPost:
- signature_status = lasso_node_verify_signature(LASSO_PROFILE_CONTEXT(login)->request,
+ signature_status = lasso_node_verify_signature(LASSO_PROFILE(login)->request,
remote_provider->ca_certificate);
break;
}
@@ -751,11 +751,11 @@ lasso_login_init_from_authn_request_msg(LassoLogin *login,
if (signature_status == 0 || signature_status == 2) {
switch (signature_status) {
case 0: /* Invalid Signature */
- lasso_profile_context_set_response_status(LASSO_PROFILE_CONTEXT(login),
+ lasso_profile_set_response_status(LASSO_PROFILE(login),
lassoLibStatusCodeInvalidSignature);
break;
case 2: /* Unsigned AuthnRequest */
- lasso_profile_context_set_response_status(LASSO_PROFILE_CONTEXT(login),
+ lasso_profile_set_response_status(LASSO_PROFILE(login),
lassoLibStatusCodeUnsignedAuthnRequest);
break;
}
@@ -792,19 +792,19 @@ lasso_login_init_request(LassoLogin *login,
response = lasso_artifact_new_from_lares(response_msg, NULL);
break;
}
- LASSO_PROFILE_CONTEXT(login)->response = response;
+ LASSO_PROFILE(login)->response = response;
/* get remote identityProviderSuccinctID */
identityProviderSuccinctID = lasso_artifact_get_identityProviderSuccinctID(LASSO_ARTIFACT(response));
- LASSO_PROFILE_CONTEXT(login)->remote_providerID = lasso_server_get_providerID_from_hash(LASSO_PROFILE_CONTEXT(login)->server,
+ LASSO_PROFILE(login)->remote_providerID = lasso_server_get_providerID_from_hash(LASSO_PROFILE(login)->server,
identityProviderSuccinctID);
xmlFree(identityProviderSuccinctID);
- LASSO_PROFILE_CONTEXT(login)->response_type = lassoMessageTypeArtifact;
+ LASSO_PROFILE(login)->response_type = lassoMessageTypeArtifact;
/* create SamlpRequest */
- artifact = lasso_artifact_get_samlArt(LASSO_ARTIFACT(LASSO_PROFILE_CONTEXT(login)->response));
- LASSO_PROFILE_CONTEXT(login)->request = lasso_request_new(artifact);
- LASSO_PROFILE_CONTEXT(login)->request_type = lassoMessageTypeRequest;
+ artifact = lasso_artifact_get_samlArt(LASSO_ARTIFACT(LASSO_PROFILE(login)->response));
+ LASSO_PROFILE(login)->request = lasso_request_new(artifact);
+ LASSO_PROFILE(login)->request_type = lassoMessageTypeRequest;
xmlFree(artifact);
return (0);
@@ -819,7 +819,7 @@ lasso_login_must_authenticate(LassoLogin *login)
gchar *str;
/* verify if the user must be authenticated or not */
- str = lasso_node_get_child_content(LASSO_PROFILE_CONTEXT(login)->request, "IsPassive", NULL);
+ str = lasso_node_get_child_content(LASSO_PROFILE(login)->request, "IsPassive", NULL);
if (str != NULL) {
if (xmlStrEqual(str, "false")) {
isPassive = FALSE;
@@ -827,7 +827,7 @@ lasso_login_must_authenticate(LassoLogin *login)
xmlFree(str);
}
- str = lasso_node_get_child_content(LASSO_PROFILE_CONTEXT(login)->request, "ForceAuthn", NULL);
+ str = lasso_node_get_child_content(LASSO_PROFILE(login)->request, "ForceAuthn", NULL);
if (str != NULL) {
if (xmlStrEqual(str, "true")) {
forceAuthn = TRUE;
@@ -835,11 +835,11 @@ lasso_login_must_authenticate(LassoLogin *login)
xmlFree(str);
}
- if ((forceAuthn == TRUE || LASSO_PROFILE_CONTEXT(login)->identity == NULL) && isPassive == FALSE) {
+ if ((forceAuthn == TRUE || LASSO_PROFILE(login)->identity == NULL) && isPassive == FALSE) {
must_authenticate = TRUE;
}
- else if (LASSO_PROFILE_CONTEXT(login)->identity == NULL && isPassive == TRUE) {
- lasso_profile_context_set_response_status(LASSO_PROFILE_CONTEXT(login),
+ else if (LASSO_PROFILE(login)->identity == NULL && isPassive == TRUE) {
+ lasso_profile_set_response_status(LASSO_PROFILE(login),
lassoLibStatusCodeNoPassive);
}
@@ -850,9 +850,9 @@ gint
lasso_login_process_authn_response_msg(LassoLogin *login,
gchar *authn_response_msg)
{
- LASSO_PROFILE_CONTEXT(login)->response = lasso_authn_response_new_from_export(authn_response_msg,
+ LASSO_PROFILE(login)->response = lasso_authn_response_new_from_export(authn_response_msg,
lassoNodeExportTypeBase64);
- LASSO_PROFILE_CONTEXT(login)->response_type = lassoMessageTypeAuthnResponse;
+ LASSO_PROFILE(login)->response_type = lassoMessageTypeAuthnResponse;
return (lasso_login_process_response_status_and_assertion(login));
}
@@ -861,11 +861,11 @@ gint
lasso_login_process_request_msg(LassoLogin *login,
gchar *request_msg)
{
- LASSO_PROFILE_CONTEXT(login)->request = lasso_request_new_from_export(request_msg,
+ LASSO_PROFILE(login)->request = lasso_request_new_from_export(request_msg,
lassoNodeExportTypeSoap);
- LASSO_PROFILE_CONTEXT(login)->request_type = lassoMessageTypeRequest;
+ LASSO_PROFILE(login)->request_type = lassoMessageTypeRequest;
- login->assertionArtifact = lasso_node_get_child_content(LASSO_PROFILE_CONTEXT(login)->request,
+ login->assertionArtifact = lasso_node_get_child_content(LASSO_PROFILE(login)->request,
"AssertionArtifact", lassoSamlProtocolHRef);
return (0);
@@ -875,9 +875,9 @@ gint
lasso_login_process_response_msg(LassoLogin *login,
gchar *response_msg)
{
- LASSO_PROFILE_CONTEXT(login)->response = lasso_response_new_from_export(response_msg,
+ LASSO_PROFILE(login)->response = lasso_response_new_from_export(response_msg,
lassoNodeExportTypeSoap);
- LASSO_PROFILE_CONTEXT(login)->response_type = lassoMessageTypeResponse;
+ LASSO_PROFILE(login)->response_type = lassoMessageTypeResponse;
return (lasso_login_process_response_status_and_assertion(login));
}
@@ -894,7 +894,7 @@ lasso_login_dispose(LassoLogin *login)
}
login->private->dispose_has_run = TRUE;
- debug("ProfileContext object 0x%x disposed ...\n", login);
+ debug("Login object 0x%x disposed ...\n", login);
/* unref reference counted objects */
@@ -959,7 +959,7 @@ GType lasso_login_get_type() {
(GInstanceInitFunc) lasso_login_instance_init,
};
- this_type = g_type_register_static(LASSO_TYPE_PROFILE_CONTEXT,
+ this_type = g_type_register_static(LASSO_TYPE_PROFILE,
"LassoLogin",
&this_info, 0);
}
@@ -994,27 +994,27 @@ lasso_login_new_from_dump(LassoServer *server,
node_dump = lasso_node_new_from_dump(dump);
- /* profile context attributes */
- LASSO_PROFILE_CONTEXT(login)->nameIdentifier = lasso_node_get_child_content(node_dump, "NameIdentifier", NULL);
- LASSO_PROFILE_CONTEXT(login)->remote_providerID = lasso_node_get_child_content(node_dump, "RemoteProviderID", NULL);
- LASSO_PROFILE_CONTEXT(login)->msg_url = lasso_node_get_child_content(node_dump, "MsgUrl", NULL);
- LASSO_PROFILE_CONTEXT(login)->msg_body = lasso_node_get_child_content(node_dump, "MsgBody", NULL);
- LASSO_PROFILE_CONTEXT(login)->msg_relayState = lasso_node_get_child_content(node_dump, "MsgRelayState", NULL);
+ /* profile attributes */
+ LASSO_PROFILE(login)->nameIdentifier = lasso_node_get_child_content(node_dump, "NameIdentifier", NULL);
+ LASSO_PROFILE(login)->remote_providerID = lasso_node_get_child_content(node_dump, "RemoteProviderID", NULL);
+ LASSO_PROFILE(login)->msg_url = lasso_node_get_child_content(node_dump, "MsgUrl", NULL);
+ LASSO_PROFILE(login)->msg_body = lasso_node_get_child_content(node_dump, "MsgBody", NULL);
+ LASSO_PROFILE(login)->msg_relayState = lasso_node_get_child_content(node_dump, "MsgRelayState", NULL);
type = lasso_node_get_child_content(node_dump, "RequestType", NULL);
- LASSO_PROFILE_CONTEXT(login)->request_type = atoi(type);
+ LASSO_PROFILE(login)->request_type = atoi(type);
xmlFree(type);
request_node = lasso_node_get_child(node_dump, "Request", NULL);
if (request_node != NULL) {
export = lasso_node_export(request_node);
- switch (LASSO_PROFILE_CONTEXT(login)->request_type) {
+ switch (LASSO_PROFILE(login)->request_type) {
case lassoMessageTypeAuthnRequest:
- LASSO_PROFILE_CONTEXT(login)->request = lasso_authn_request_new_from_export(export,
+ LASSO_PROFILE(login)->request = lasso_authn_request_new_from_export(export,
lassoNodeExportTypeXml);
break;
case lassoMessageTypeRequest:
- LASSO_PROFILE_CONTEXT(login)->request = lasso_request_new_from_export(export,
+ LASSO_PROFILE(login)->request = lasso_request_new_from_export(export,
lassoNodeExportTypeXml);
break;
default:
@@ -1025,19 +1025,19 @@ lasso_login_new_from_dump(LassoServer *server,
}
type = lasso_node_get_child_content(node_dump, "ResponseType", NULL);
- LASSO_PROFILE_CONTEXT(login)->response_type = atoi(type);
+ LASSO_PROFILE(login)->response_type = atoi(type);
xmlFree(type);
response_node = lasso_node_get_child(node_dump, "Response", NULL);
if (response_node != NULL) {
export = lasso_node_export(response_node);
- switch (LASSO_PROFILE_CONTEXT(login)->response_type) {
+ switch (LASSO_PROFILE(login)->response_type) {
case lassoMessageTypeAuthnResponse:
- LASSO_PROFILE_CONTEXT(login)->response = lasso_authn_response_new_from_export(export,
+ LASSO_PROFILE(login)->response = lasso_authn_response_new_from_export(export,
lassoNodeExportTypeXml);
break;
case lassoMessageTypeRequest:
- LASSO_PROFILE_CONTEXT(login)->response = lasso_response_new_from_export(export,
+ LASSO_PROFILE(login)->response = lasso_response_new_from_export(export,
lassoNodeExportTypeXml);
break;
default:
@@ -1048,7 +1048,7 @@ lasso_login_new_from_dump(LassoServer *server,
}
type = lasso_node_get_child_content(node_dump, "ProviderType", NULL);
- LASSO_PROFILE_CONTEXT(login)->provider_type = atoi(type);
+ LASSO_PROFILE(login)->provider_type = atoi(type);
xmlFree(type);
/* login attributes */
diff --git a/lasso/id-ff/login.h b/lasso/id-ff/login.h
index 9b3dabdf..518db617 100644
--- a/lasso/id-ff/login.h
+++ b/lasso/id-ff/login.h
@@ -31,7 +31,7 @@ extern "C" {
#endif /* __cplusplus */
-#include <lasso/environs/profile_context.h>
+#include <lasso/environs/profile.h>
#include <lasso/protocols/authn_request.h>
#include <lasso/protocols/authn_response.h>
@@ -55,7 +55,7 @@ typedef enum {
} lassoLoginProtocolProfiles;
struct _LassoLogin {
- LassoProfileContext parent;
+ LassoProfile parent;
/*< public >*/
lassoLoginProtocolProfiles protocolProfile;
@@ -66,7 +66,7 @@ struct _LassoLogin {
};
struct _LassoLoginClass {
- LassoProfileContextClass parent;
+ LassoProfileClass parent;
};
LASSO_EXPORT GType lasso_login_get_type (void);
diff --git a/lasso/id-ff/logout.c b/lasso/id-ff/logout.c
index d4df04f3..0145f1ec 100644
--- a/lasso/id-ff/logout.c
+++ b/lasso/id-ff/logout.c
@@ -63,17 +63,17 @@ lasso_logout_dump(LassoLogout *logout)
gint
lasso_logout_build_request_msg(LassoLogout *logout)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoProvider *provider;
xmlChar *protocolProfile;
g_return_val_if_fail(LASSO_IS_LOGOUT(logout), -1);
- profileContext = LASSO_PROFILE_CONTEXT(logout);
+ profile = LASSO_PROFILE(logout);
- provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID);
+ provider = lasso_server_get_provider(profile->server, profile->remote_providerID);
if(provider==NULL){
- message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profileContext->remote_providerID);
+ message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profile->remote_providerID);
return(-2);
}
@@ -85,27 +85,29 @@ lasso_logout_build_request_msg(LassoLogout *logout)
return(-3);
}
- if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){
+ if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \
+ xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)) {
debug("Building a soap request message\n");
- profileContext->request_type = lassoHttpMethodSoap;
+ profile->request_type = lassoHttpMethodSoap;
/* sign the request message */
- lasso_samlp_request_abstract_set_signature(LASSO_SAMLP_REQUEST_ABSTRACT(profileContext->request),
- profileContext->server->signature_method,
- profileContext->server->private_key,
- profileContext->server->certificate);
+ lasso_samlp_request_abstract_set_signature(LASSO_SAMLP_REQUEST_ABSTRACT(profile->request),
+ profile->server->signature_method,
+ profile->server->private_key,
+ profile->server->certificate);
- profileContext->msg_url = lasso_provider_get_soapEndpoint(provider);
- profileContext->msg_body = lasso_node_export_to_soap(profileContext->request);
+ profile->msg_url = lasso_provider_get_soapEndpoint(provider);
+ profile->msg_body = lasso_node_export_to_soap(profile->request);
}
- else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){
+ else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp) || \
+ xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)) {
debug("Building a http get request message\n");
- profileContext->request_type = lassoHttpMethodRedirect;
- profileContext->msg_url = lasso_provider_get_singleLogoutServiceURL(provider);
- profileContext->msg_url = lasso_node_export_to_query(profileContext->request,
- profileContext->server->signature_method,
- profileContext->server->private_key);
- profileContext->msg_body = NULL;
+ profile->request_type = lassoHttpMethodRedirect;
+ profile->msg_url = lasso_provider_get_singleLogoutServiceURL(provider);
+ profile->msg_url = lasso_node_export_to_query(profile->request,
+ profile->server->signature_method,
+ profile->server->private_key);
+ profile->msg_body = NULL;
}
return(0);
@@ -114,7 +116,7 @@ lasso_logout_build_request_msg(LassoLogout *logout)
gint
lasso_logout_build_response_msg(LassoLogout *logout)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoProvider *provider;
xmlChar *protocolProfile;
@@ -123,32 +125,34 @@ lasso_logout_build_response_msg(LassoLogout *logout)
return(-1);
}
- profileContext = LASSO_PROFILE_CONTEXT(logout);
+ profile = LASSO_PROFILE(logout);
- provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID);
- if(provider==NULL){
- message(G_LOG_LEVEL_ERROR, "Provider not found %s\n", profileContext->remote_providerID);
+ provider = lasso_server_get_provider(profile->server, profile->remote_providerID);
+ if(provider == NULL) {
+ message(G_LOG_LEVEL_ERROR, "Provider not found %s\n", profile->remote_providerID);
return(-2);
}
protocolProfile = lasso_provider_get_singleLogoutProtocolProfile(provider);
- if(protocolProfile==NULL){
+ if(protocolProfile == NULL) {
message(G_LOG_LEVEL_ERROR, "Single Logout Protocol profile not found\n");
return(-3);
}
- if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){
+ if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \
+ xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)) {
debug("Building a soap response message\n");
- profileContext->msg_url = NULL;
- profileContext->msg_body = lasso_node_export_to_soap(profileContext->response);
+ profile->msg_url = NULL;
+ profile->msg_body = lasso_node_export_to_soap(profile->response);
}
- else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){
+ else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp) || \
+ xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)) {
debug("Building a http get response message\n");
- profileContext->response_type = lassoHttpMethodRedirect;
- profileContext->msg_url = lasso_node_export_to_query(profileContext->response,
- profileContext->server->signature_method,
- profileContext->server->private_key);
- profileContext->msg_body = NULL;
+ profile->response_type = lassoHttpMethodRedirect;
+ profile->msg_url = lasso_node_export_to_query(profile->response,
+ profile->server->signature_method,
+ profile->server->private_key);
+ profile->msg_body = NULL;
}
return(0);
@@ -163,18 +167,18 @@ lasso_logout_destroy(LassoLogout *logout)
gchar*
lasso_logout_get_next_providerID(LassoLogout *logout)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
gchar *current_provider_id;
int i;
g_return_val_if_fail(LASSO_IS_LOGOUT(logout), NULL);
- profileContext = LASSO_PROFILE_CONTEXT(logout);
+ profile = LASSO_PROFILE(logout);
/* if a ProviderID from a SP request, pass it and return the next provider id found */
- for(i = 0; i<profileContext->session->providerIDs->len; i++){
- current_provider_id = g_strdup(g_ptr_array_index(profileContext->session->providerIDs, i));
+ for(i = 0; i<profile->session->providerIDs->len; i++){
+ current_provider_id = g_strdup(g_ptr_array_index(profile->session->providerIDs, i));
if(logout->initial_remote_providerID!=NULL){
if(xmlStrEqual(current_provider_id, logout->initial_remote_providerID)){
debug("It's the ProviderID of the SP requester (%s) : %s, pass it\n",
@@ -194,39 +198,39 @@ gint
lasso_logout_init_request(LassoLogout *logout,
gchar *remote_providerID)
{
- LassoProfileContext *profileContext;
- LassoNode *nameIdentifier;
- LassoFederation *federation;
+ LassoProfile *profile;
+ LassoNode *nameIdentifier;
+ LassoFederation *federation;
xmlChar *content, *nameQualifier, *format;
g_return_val_if_fail(LASSO_IS_LOGOUT(logout), -1);
- profileContext = LASSO_PROFILE_CONTEXT(logout);
+ profile = LASSO_PROFILE(logout);
if(remote_providerID == NULL) {
/* message(G_LOG_LEVEL_INFO, "No remote provider id, get the next assertion peer provider id\n"); */
- profileContext->remote_providerID = lasso_session_get_next_assertion_remote_providerID(profileContext->session);
+ profile->remote_providerID = lasso_session_get_next_assertion_remote_providerID(profile->session);
}
else {
/* message(G_LOG_LEVEL_INFO, "A remote provider id for logout request : %s\n", remote_providerID); */
- profileContext->remote_providerID = g_strdup(remote_providerID);
+ profile->remote_providerID = g_strdup(remote_providerID);
}
- if(profileContext->remote_providerID == NULL) {
+ if(profile->remote_providerID == NULL) {
message(G_LOG_LEVEL_ERROR, "No provider id for init request\n");
return(-2);
}
/* get federation */
- federation = lasso_identity_get_federation(profileContext->identity, profileContext->remote_providerID);
+ federation = lasso_identity_get_federation(profile->identity, profile->remote_providerID);
if(federation == NULL) {
message(G_LOG_LEVEL_ERROR, "Federation not found\n");
return(-3);
}
/* get the name identifier (!!! depend on the provider type : SP or IDP !!!)*/
- switch(profileContext->provider_type){
+ switch(profile->provider_type){
case lassoProviderTypeSp:
nameIdentifier = lasso_federation_get_local_nameIdentifier(federation);
if(nameIdentifier == NULL) {
@@ -245,7 +249,7 @@ lasso_logout_init_request(LassoLogout *logout,
}
if(nameIdentifier == NULL) {
- message(G_LOG_LEVEL_ERROR, "Name identifier not found for %s\n", profileContext->remote_providerID);
+ message(G_LOG_LEVEL_ERROR, "Name identifier not found for %s\n", profile->remote_providerID);
return(-5);
}
@@ -253,16 +257,16 @@ lasso_logout_init_request(LassoLogout *logout,
content = lasso_node_get_content(nameIdentifier);
nameQualifier = lasso_node_get_attr_value(nameIdentifier, "NameQualifier", NULL);
format = lasso_node_get_attr_value(nameIdentifier, "Format", NULL);
- profileContext->request = lasso_logout_request_new(profileContext->server->providerID,
- content,
- nameQualifier,
- format);
+ profile->request = lasso_logout_request_new(profile->server->providerID,
+ content,
+ nameQualifier,
+ format);
xmlFree(content);
xmlFree(nameQualifier);
xmlFree(format);
lasso_node_destroy(nameIdentifier);
- if(profileContext->request==NULL){
+ if(profile->request == NULL) {
message(G_LOG_LEVEL_ERROR, "Error while creating the request\n");
return(-6);
}
@@ -274,21 +278,21 @@ gint lasso_logout_load_request_msg(LassoLogout *logout,
gchar *request_msg,
lassoHttpMethods request_method)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
g_return_val_if_fail(LASSO_IS_LOGOUT(logout), -1);
g_return_val_if_fail(request_msg!=NULL, -2);
- profileContext = LASSO_PROFILE_CONTEXT(logout);
+ profile = LASSO_PROFILE(logout);
switch(request_method){
case lassoHttpMethodSoap:
debug("Build a logout request from soap msg\n");
- profileContext->request = lasso_logout_request_new_from_export(request_msg, lassoNodeExportTypeSoap);
+ profile->request = lasso_logout_request_new_from_export(request_msg, lassoNodeExportTypeSoap);
break;
case lassoHttpMethodRedirect:
debug("Build a logout request from query msg\n");
- profileContext->request = lasso_logout_request_new_from_export(request_msg, lassoNodeExportTypeQuery);
+ profile->request = lasso_logout_request_new_from_export(request_msg, lassoNodeExportTypeQuery);
break;
case lassoHttpMethodGet:
debug("TODO, implement the get method\n");
@@ -297,18 +301,18 @@ gint lasso_logout_load_request_msg(LassoLogout *logout,
message(G_LOG_LEVEL_ERROR, "Invalid request method\n");
return(-3);
}
- if(profileContext->request==NULL){
+ if(profile->request == NULL) {
message(G_LOG_LEVEL_ERROR, "Error while building the request from msg\n");
return(-4);
}
/* get the NameIdentifier to load identity dump */
- profileContext->nameIdentifier = lasso_node_get_child_content(profileContext->request,
- "NameIdentifier", NULL);
+ profile->nameIdentifier = lasso_node_get_child_content(profile->request,
+ "NameIdentifier", NULL);
/* get the RelayState */
- profileContext->msg_relayState = lasso_node_get_child_content(profileContext->request,
- "RelayState", NULL);
+ profile->msg_relayState = lasso_node_get_child_content(profile->request,
+ "RelayState", NULL);
return(0);
}
@@ -316,7 +320,7 @@ gint lasso_logout_load_request_msg(LassoLogout *logout,
gint
lasso_logout_process_request(LassoLogout *logout)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoFederation *federation;
LassoNode *nameIdentifier, *assertion;
LassoNode *statusCode;
@@ -325,54 +329,54 @@ lasso_logout_process_request(LassoLogout *logout)
g_return_val_if_fail(LASSO_IS_LOGOUT(logout), -1);
- profileContext = LASSO_PROFILE_CONTEXT(logout);
+ profile = LASSO_PROFILE(logout);
- if(profileContext->request == NULL) {
+ if(profile->request == NULL) {
message(G_LOG_LEVEL_ERROR, "LogoutRequest not found\n");
return(-1);
}
/* set the remote provider id from the request */
- remote_providerID = lasso_node_get_child_content(profileContext->request, "ProviderID", NULL);
+ remote_providerID = lasso_node_get_child_content(profile->request, "ProviderID", NULL);
if(remote_providerID == NULL) {
message(G_LOG_LEVEL_ERROR, "ProviderID in LogoutRequest not found\n");
return(-1);
}
- profileContext->remote_providerID = remote_providerID;
+ profile->remote_providerID = remote_providerID;
/* set LogoutResponse */
- profileContext->response = lasso_logout_response_new(profileContext->server->providerID,
- lassoSamlStatusCodeSuccess,
- profileContext->request);
- if(profileContext->response == NULL) {
+ profile->response = lasso_logout_response_new(profile->server->providerID,
+ lassoSamlStatusCodeSuccess,
+ profile->request);
+ if(profile->response == NULL) {
message(G_LOG_LEVEL_ERROR, "Error while building response\n");
return(-5);
}
- statusCode = lasso_node_get_child(profileContext->response, "StatusCode", NULL);
+ statusCode = lasso_node_get_child(profile->response, "StatusCode", NULL);
statusCode_class = LASSO_NODE_GET_CLASS(statusCode);
- nameIdentifier = lasso_node_get_child(profileContext->request, "NameIdentifier", NULL);
+ nameIdentifier = lasso_node_get_child(profile->request, "NameIdentifier", NULL);
if(nameIdentifier == NULL) {
message(G_LOG_LEVEL_ERROR, "Name identifier not found in logout request\n");
statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist);
return(-6);
}
- remote_providerID = lasso_node_get_child_content(profileContext->request, "ProviderID", NULL);
+ remote_providerID = lasso_node_get_child_content(profile->request, "ProviderID", NULL);
if(remote_providerID == NULL) {
message(G_LOG_LEVEL_ERROR, "Provider id not found in logout request\n");
return(-7);
}
/* verify authentication */
- if(profileContext->identity == NULL) {
+ if(profile->identity == NULL) {
message(G_LOG_LEVEL_WARNING, "Identity not found\n");
statusCode_class->set_prop(statusCode, "Value", lassoSamlStatusCodeRequestDenied);
return(-1);
}
- assertion = lasso_session_get_assertion(profileContext->session, remote_providerID);
+ assertion = lasso_session_get_assertion(profile->session, remote_providerID);
if(assertion == NULL) {
message(G_LOG_LEVEL_WARNING, "%s has no assertion\n", remote_providerID);
statusCode_class->set_prop(statusCode, "Value", lassoSamlStatusCodeRequestDenied);
@@ -381,7 +385,7 @@ lasso_logout_process_request(LassoLogout *logout)
lasso_node_destroy(assertion);
/* Verify federation */
- federation = lasso_identity_get_federation(profileContext->identity, remote_providerID);
+ federation = lasso_identity_get_federation(profile->identity, remote_providerID);
if(federation == NULL) {
message(G_LOG_LEVEL_WARNING, "No federation for %s\n", remote_providerID);
statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist);
@@ -395,23 +399,23 @@ lasso_logout_process_request(LassoLogout *logout)
}
/* verification is ok, save name identifier in logout object */
- switch(profileContext->provider_type) {
+ switch(profile->provider_type) {
case lassoProviderTypeSp:
/* at sp, everything is ok, delete the assertion */
- lasso_session_remove_assertion(profileContext->session, profileContext->remote_providerID);
+ lasso_session_remove_assertion(profile->session, profile->remote_providerID);
break;
case lassoProviderTypeIdp:
/* if more than one sp registered, backup original infos of the sp requester */
/* FIXME : get the nb of remote providers with a proper way */
- logout->initial_remote_providerID = g_strdup(profileContext->remote_providerID);
- if(profileContext->session->providerIDs->len>1){
- logout->initial_request = profileContext->request;
- profileContext->request = NULL;
+ logout->initial_remote_providerID = g_strdup(profile->remote_providerID);
+ if(profile->session->providerIDs->len>1){
+ logout->initial_request = profile->request;
+ profile->request = NULL;
- logout->initial_response = profileContext->response;
- profileContext->response = NULL;
+ logout->initial_response = profile->response;
+ profile->response = NULL;
- profileContext->remote_providerID = NULL;
+ profile->remote_providerID = NULL;
}
break;
@@ -427,63 +431,63 @@ lasso_logout_process_response_msg(LassoLogout *logout,
gchar *response_msg,
lassoHttpMethods response_method)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
xmlChar *statusCodeValue;
LassoNode *statusCode;
g_return_val_if_fail(LASSO_IS_LOGOUT(logout), -1);
- g_return_val_if_fail(response_msg!=NULL, -2);
+ g_return_val_if_fail(response_msg != NULL, -2);
- profileContext = LASSO_PROFILE_CONTEXT(logout);
+ profile = LASSO_PROFILE(logout);
/* parse LogoutResponse */
- switch(response_method){
+ switch(response_method) {
case lassoHttpMethodSoap:
- profileContext->response = lasso_logout_response_new_from_export(response_msg, lassoNodeExportTypeSoap);
+ profile->response = lasso_logout_response_new_from_export(response_msg, lassoNodeExportTypeSoap);
break;
case lassoHttpMethodRedirect:
- profileContext->response = lasso_logout_response_new_from_export(response_msg, lassoNodeExportTypeQuery);
+ profile->response = lasso_logout_response_new_from_export(response_msg, lassoNodeExportTypeQuery);
break;
default:
message(G_LOG_LEVEL_ERROR, "Unknown response method\n");
return(-3);
}
- if(profileContext->response==NULL){
+ if(profile->response == NULL) {
message(G_LOG_LEVEL_ERROR, "LogoutResponse is NULL\n");
return(-1);
}
- statusCode = lasso_node_get_child(profileContext->response, "StatusCode", NULL);
+ statusCode = lasso_node_get_child(profile->response, "StatusCode", NULL);
- if(statusCode==NULL){
+ if(statusCode == NULL) {
message(G_LOG_LEVEL_ERROR, "StatusCode node not found\n");
return(-1);
}
statusCodeValue = lasso_node_get_attr_value(statusCode, "Value", NULL);
- if(!xmlStrEqual(statusCodeValue, lassoSamlStatusCodeSuccess)){
+ if(!xmlStrEqual(statusCodeValue, lassoSamlStatusCodeSuccess)) {
return(-1);
}
- profileContext->remote_providerID = lasso_node_get_child_content(profileContext->response, "ProviderID", NULL);
+ profile->remote_providerID = lasso_node_get_child_content(profile->response, "ProviderID", NULL);
/* response is ok, so delete the assertion */
- switch(profileContext->provider_type){
+ switch(profile->provider_type) {
case lassoProviderTypeSp:
break;
case lassoProviderTypeIdp:
/* response os ok, delete the assertion */
- lasso_session_remove_assertion(profileContext->session, profileContext->remote_providerID);
- message(G_LOG_LEVEL_INFO, "Remove assertion for %s\n", profileContext->remote_providerID);
+ lasso_session_remove_assertion(profile->session, profile->remote_providerID);
+ message(G_LOG_LEVEL_INFO, "Remove assertion for %s\n", profile->remote_providerID);
/* if no more assertion for other providers, remove assertion of the original provider and restore the original requester infos */
- if(profileContext->session->providerIDs->len == 1){
+ if(profile->session->providerIDs->len == 1){
message(G_LOG_LEVEL_WARNING, "remove assertion of the original provider\n");
- lasso_session_remove_assertion(profileContext->session, logout->initial_remote_providerID);
+ lasso_session_remove_assertion(profile->session, logout->initial_remote_providerID);
- profileContext->remote_providerID = logout->initial_remote_providerID;
- profileContext->request = logout->initial_request;
- profileContext->response = logout->initial_response;
+ profile->remote_providerID = logout->initial_remote_providerID;
+ profile->request = logout->initial_request;
+ profile->response = logout->initial_response;
}
break;
@@ -572,7 +576,7 @@ GType lasso_logout_get_type() {
(GInstanceInitFunc) lasso_logout_instance_init,
};
- this_type = g_type_register_static(LASSO_TYPE_PROFILE_CONTEXT,
+ this_type = g_type_register_static(LASSO_TYPE_PROFILE,
"LassoLogout",
&this_info, 0);
}
diff --git a/lasso/id-ff/logout.h b/lasso/id-ff/logout.h
index 51d08e8c..cbd0be99 100644
--- a/lasso/id-ff/logout.h
+++ b/lasso/id-ff/logout.h
@@ -30,7 +30,7 @@
extern "C" {
#endif /* __cplusplus */
-#include <lasso/environs/profile_context.h>
+#include <lasso/environs/profile.h>
#include <lasso/protocols/logout_request.h>
#include <lasso/protocols/logout_response.h>
@@ -46,7 +46,7 @@ typedef struct _LassoLogoutClass LassoLogoutClass;
typedef struct _LassoLogoutPrivate LassoLogoutPrivate;
struct _LassoLogout {
- LassoProfileContext parent;
+ LassoProfile parent;
/*< public >*/
LassoNode *initial_request;
@@ -58,7 +58,7 @@ struct _LassoLogout {
};
struct _LassoLogoutClass {
- LassoNodeClass parent;
+ LassoProfileClass parent;
};
diff --git a/lasso/id-ff/name_identifier_mapping.c b/lasso/id-ff/name_identifier_mapping.c
index 20d89444..2a7b6f24 100644
--- a/lasso/id-ff/name_identifier_mapping.c
+++ b/lasso/id-ff/name_identifier_mapping.c
@@ -42,7 +42,7 @@ lasso_name_identifier_mapping_dump(LassoNameIdentifierMapping *mapping)
gint
lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapping)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoProvider *provider;
xmlChar *protocolProfile;
GError *err = NULL;
@@ -50,12 +50,12 @@ lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapp
g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING(mapping), -1);
- profileContext = LASSO_PROFILE_CONTEXT(mapping);
+ profile = LASSO_PROFILE(mapping);
/* get the prototocol profile of the name_identifier_mapping */
- provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID);
- if(provider==NULL){
- message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profileContext->remote_providerID);
+ provider = lasso_server_get_provider(profile->server, profile->remote_providerID);
+ if(provider == NULL) {
+ message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profile->remote_providerID);
return(-2);
}
@@ -67,19 +67,21 @@ lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapp
return (ret);
}
- if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){
+ if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \
+ xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)) {
debug("building a soap request message\n");
- profileContext->request_type = lassoHttpMethodSoap;
- profileContext->msg_url = lasso_provider_get_nameIdentifierMappingServiceURL(provider, NULL);
- profileContext->msg_body = lasso_node_export_to_soap(profileContext->request);
+ profile->request_type = lassoHttpMethodSoap;
+ profile->msg_url = lasso_provider_get_nameIdentifierMappingServiceURL(provider, NULL);
+ profile->msg_body = lasso_node_export_to_soap(profile->request);
}
- else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){
+ else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp) || \
+ xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)) {
debug("building a http get request message\n");
- profileContext->request_type = lassoHttpMethodRedirect;
- profileContext->msg_url = lasso_node_export_to_query(profileContext->request,
- profileContext->server->signature_method,
- profileContext->server->private_key);
- profileContext->msg_body = NULL;
+ profile->request_type = lassoHttpMethodRedirect;
+ profile->msg_url = lasso_node_export_to_query(profile->request,
+ profile->server->signature_method,
+ profile->server->private_key);
+ profile->msg_body = NULL;
}
return(0);
@@ -88,7 +90,7 @@ lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapp
gint
lasso_name_identifier_mapping_build_response_msg(LassoNameIdentifierMapping *mapping)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoProvider *provider;
xmlChar *protocolProfile;
GError *err = NULL;
@@ -96,11 +98,11 @@ lasso_name_identifier_mapping_build_response_msg(LassoNameIdentifierMapping *map
g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING(mapping), -1);
- profileContext = LASSO_PROFILE_CONTEXT(mapping);
+ profile = LASSO_PROFILE(mapping);
- provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID);
+ provider = lasso_server_get_provider(profile->server, profile->remote_providerID);
if(provider==NULL){
- message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profileContext->remote_providerID);
+ message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profile->remote_providerID);
return(-2);
}
@@ -112,18 +114,20 @@ lasso_name_identifier_mapping_build_response_msg(LassoNameIdentifierMapping *map
return(ret);
}
- if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){
+ if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \
+ xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)) {
debug("building a soap response message\n");
- profileContext->msg_url = lasso_provider_get_nameIdentifierMappingServiceURL(provider, NULL);
- profileContext->msg_body = lasso_node_export_to_soap(profileContext->response);
+ profile->msg_url = lasso_provider_get_nameIdentifierMappingServiceURL(provider, NULL);
+ profile->msg_body = lasso_node_export_to_soap(profile->response);
}
- else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){
+ else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp) || \
+ xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)) {
debug("building a http get response message\n");
- profileContext->response_type = lassoHttpMethodRedirect;
- profileContext->msg_url = lasso_node_export_to_query(profileContext->response,
- profileContext->server->signature_method,
- profileContext->server->private_key);
- profileContext->msg_body = NULL;
+ profile->response_type = lassoHttpMethodRedirect;
+ profile->msg_url = lasso_node_export_to_query(profile->response,
+ profile->server->signature_method,
+ profile->server->private_key);
+ profile->msg_body = NULL;
}
return(0);
@@ -131,30 +135,30 @@ lasso_name_identifier_mapping_build_response_msg(LassoNameIdentifierMapping *map
gint
lasso_name_identifier_mapping_init_request(LassoNameIdentifierMapping *mapping,
- gchar *remote_providerID)
+ gchar *remote_providerID)
{
- LassoProfileContext *profileContext;
- LassoNode *nameIdentifier;
- LassoFederation *federation;
+ LassoProfile *profile;
+ LassoNode *nameIdentifier;
+ LassoFederation *federation;
xmlChar *content, *nameQualifier, *format;
g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING(mapping), -1);
g_return_val_if_fail(remote_providerID!=NULL, -2);
- profileContext = LASSO_PROFILE_CONTEXT(mapping);
+ profile = LASSO_PROFILE(mapping);
- profileContext->remote_providerID = remote_providerID;
+ profile->remote_providerID = remote_providerID;
/* get federation */
- federation = lasso_identity_get_federation(profileContext->identity, profileContext->remote_providerID);
+ federation = lasso_identity_get_federation(profile->identity, profile->remote_providerID);
if(federation == NULL) {
message(G_LOG_LEVEL_ERROR, "error, federation not found\n");
return(-3);
}
/* get the name identifier (!!! depend on the provider type : SP or IDP !!!)*/
- switch(profileContext->provider_type){
+ switch(profile->provider_type){
case lassoProviderTypeSp:
debug("service provider\n");
nameIdentifier = LASSO_NODE(lasso_federation_get_local_nameIdentifier(federation));
@@ -182,12 +186,12 @@ lasso_name_identifier_mapping_init_request(LassoNameIdentifierMapping *mapping,
content = lasso_node_get_content(nameIdentifier);
nameQualifier = lasso_node_get_attr_value(nameIdentifier, "NameQualifier", NULL);
format = lasso_node_get_attr_value(nameIdentifier, "Format", NULL);
- profileContext->request = lasso_name_identifier_mapping_request_new(profileContext->server->providerID,
- content,
- nameQualifier,
- format);
+ profile->request = lasso_name_identifier_mapping_request_new(profile->server->providerID,
+ content,
+ nameQualifier,
+ format);
- g_return_val_if_fail(profileContext->request!=NULL, -6);
+ g_return_val_if_fail(profile->request != NULL, -6);
return(0);
}
@@ -197,7 +201,7 @@ lasso_name_identifier_mapping_process_request_msg(LassoNameIdentifierMapping *ma
gchar *request_msg,
lassoHttpMethods request_method)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoFederation *federation;
LassoNode *nameIdentifier;
LassoNode *statusCode;
@@ -207,16 +211,16 @@ lasso_name_identifier_mapping_process_request_msg(LassoNameIdentifierMapping *ma
g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING(mapping), -1);
g_return_val_if_fail(request_msg!=NULL, -2);
- profileContext = LASSO_PROFILE_CONTEXT(mapping);
+ profile = LASSO_PROFILE(mapping);
switch(request_method){
case lassoHttpMethodSoap:
debug("build a name_identifier_mapping request from soap msg\n");
- profileContext->request = lasso_name_identifier_mapping_request_new_from_soap(request_msg);
+ profile->request = lasso_name_identifier_mapping_request_new_from_soap(request_msg);
break;
case lassoHttpMethodRedirect:
debug("build a name_identifier_mapping request from query msg\n");
- profileContext->request = lasso_name_identifier_mapping_request_new_from_query(request_msg);
+ profile->request = lasso_name_identifier_mapping_request_new_from_query(request_msg);
break;
case lassoHttpMethodGet:
message(G_LOG_LEVEL_WARNING, "TODO, implement the get method\n");
@@ -227,29 +231,29 @@ lasso_name_identifier_mapping_process_request_msg(LassoNameIdentifierMapping *ma
}
/* set the remote provider id from the request */
- remote_providerID = lasso_node_get_child_content(profileContext->request, "ProviderID", NULL);
- profileContext->remote_providerID = remote_providerID;
+ remote_providerID = lasso_node_get_child_content(profile->request, "ProviderID", NULL);
+ profile->remote_providerID = remote_providerID;
/* set Name_Identifier_MappingResponse */
- profileContext->response = lasso_name_identifier_mapping_response_new(profileContext->server->providerID,
- lassoSamlStatusCodeSuccess,
- profileContext->request);
+ profile->response = lasso_name_identifier_mapping_response_new(profile->server->providerID,
+ lassoSamlStatusCodeSuccess,
+ profile->request);
- g_return_val_if_fail(profileContext->response!=NULL, -4);
+ g_return_val_if_fail(profile->response!=NULL, -4);
- statusCode = lasso_node_get_child(profileContext->response, "StatusCode", NULL);
+ statusCode = lasso_node_get_child(profile->response, "StatusCode", NULL);
statusCode_class = LASSO_NODE_GET_CLASS(statusCode);
- nameIdentifier = lasso_node_get_child(profileContext->request, "NameIdentifier", NULL);
- if(nameIdentifier==NULL){
+ nameIdentifier = lasso_node_get_child(profile->request, "NameIdentifier", NULL);
+ if(nameIdentifier == NULL) {
statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist);
return(-5);
}
- remote_providerID = lasso_node_get_child_content(profileContext->request, "ProviderID", NULL);
+ remote_providerID = lasso_node_get_child_content(profile->request, "ProviderID", NULL);
/* Verify federation */
- federation = lasso_identity_get_federation(profileContext->identity, remote_providerID);
+ federation = lasso_identity_get_federation(profile->identity, remote_providerID);
if(federation == NULL) {
message(G_LOG_LEVEL_WARNING, "No federation for %s\n", remote_providerID);
statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist);
@@ -270,7 +274,7 @@ lasso_name_identifier_mapping_process_response_msg(LassoNameIdentifierMapping *m
gchar *response_msg,
lassoHttpMethods response_method)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
xmlChar *statusCodeValue;
LassoNode *statusCode;
GError *err = NULL;
@@ -279,18 +283,18 @@ lasso_name_identifier_mapping_process_response_msg(LassoNameIdentifierMapping *m
g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING(mapping), -1);
g_return_val_if_fail(response_msg != NULL, -2);
- profileContext = LASSO_PROFILE_CONTEXT(mapping);
+ profile = LASSO_PROFILE(mapping);
/* parse NameIdentifierMappingResponse */
switch(response_method){
case lassoHttpMethodSoap:
- profileContext->response = lasso_name_identifier_mapping_response_new_from_soap(response_msg);
+ profile->response = lasso_name_identifier_mapping_response_new_from_soap(response_msg);
default:
message(G_LOG_LEVEL_ERROR, "Unknown response method\n");
return(-3);
}
- statusCode = lasso_node_get_child(profileContext->response, "StatusCode", NULL);
+ statusCode = lasso_node_get_child(profile->response, "StatusCode", NULL);
statusCodeValue = lasso_node_get_attr_value(statusCode, "Value", &err);
if (err == NULL) {
if(!xmlStrEqual(statusCodeValue, lassoSamlStatusCodeSuccess)) {
@@ -336,7 +340,7 @@ GType lasso_name_identifier_mapping_get_type() {
(GInstanceInitFunc) lasso_name_identifier_mapping_instance_init,
};
- this_type = g_type_register_static(LASSO_TYPE_PROFILE_CONTEXT,
+ this_type = g_type_register_static(LASSO_TYPE_PROFILE,
"LassoNameIdentifierMapping",
&this_info, 0);
}
diff --git a/lasso/id-ff/name_identifier_mapping.h b/lasso/id-ff/name_identifier_mapping.h
index 65225a40..bac63548 100644
--- a/lasso/id-ff/name_identifier_mapping.h
+++ b/lasso/id-ff/name_identifier_mapping.h
@@ -30,7 +30,7 @@
extern "C" {
#endif /* __cplusplus */
-#include <lasso/environs/profile_context.h>
+#include <lasso/environs/profile.h>
#include <lasso/protocols/name_identifier_mapping_request.h>
#include <lasso/protocols/name_identifier_mapping_response.h>
@@ -46,13 +46,13 @@ typedef struct _LassoNameIdentifierMapping LassoNameIdentifierMapping;
typedef struct _LassoNameIdentifierMappingClass LassoNameIdentifierMappingClass;
struct _LassoNameIdentifierMapping {
- LassoProfileContext parent;
+ LassoProfile parent;
/*< private >*/
};
struct _LassoNameIdentifierMappingClass {
- LassoNodeClass parent;
+ LassoProfileClass parent;
};
diff --git a/lasso/id-ff/profile_context.c b/lasso/id-ff/profile.c
index e90f0ac3..a13173b8 100644
--- a/lasso/id-ff/profile_context.c
+++ b/lasso/id-ff/profile.c
@@ -30,9 +30,9 @@
#include <lasso/protocols/request.h>
#include <lasso/protocols/response.h>
#include <lasso/protocols/authn_response.h>
-#include <lasso/environs/profile_context.h>
+#include <lasso/environs/profile.h>
-struct _LassoProfileContextPrivate
+struct _LassoProfilePrivate
{
gboolean dispose_has_run;
};
@@ -44,7 +44,7 @@ static GObjectClass *parent_class = NULL;
/*****************************************************************************/
gint
-lasso_profile_context_get_request_type_from_soap_msg(gchar *soap)
+lasso_profile_get_request_type_from_soap_msg(gchar *soap)
{
LassoNode *soap_node, *body_node, *request_node;
GPtrArray *children;
@@ -99,7 +99,7 @@ lasso_profile_context_get_request_type_from_soap_msg(gchar *soap)
/*****************************************************************************/
gchar*
-lasso_profile_context_dump(LassoProfileContext *ctx,
+lasso_profile_dump(LassoProfile *ctx,
const gchar *name)
{
LassoNode *node;
@@ -114,7 +114,7 @@ lasso_profile_context_dump(LassoProfileContext *ctx,
LASSO_NODE_GET_CLASS(node)->set_name(node, name);
}
else {
- LASSO_NODE_GET_CLASS(node)->set_name(node, "LassoProfileContext");
+ LASSO_NODE_GET_CLASS(node)->set_name(node, "LassoProfile");
}
if (ctx->request != NULL) {
@@ -164,8 +164,8 @@ lasso_profile_context_dump(LassoProfileContext *ctx,
}
gint
-lasso_profile_context_set_remote_providerID(LassoProfileContext *ctx,
- gchar *providerID)
+lasso_profile_set_remote_providerID(LassoProfile *ctx,
+ gchar *providerID)
{
g_free(ctx->remote_providerID);
ctx->remote_providerID = g_strdup(providerID);
@@ -174,8 +174,8 @@ lasso_profile_context_set_remote_providerID(LassoProfileContext *ctx,
}
void
-lasso_profile_context_set_response_status(LassoProfileContext *ctx,
- const gchar *statusCodeValue)
+lasso_profile_set_response_status(LassoProfile *ctx,
+ const gchar *statusCodeValue)
{
LassoNode *status, *status_code;
@@ -195,8 +195,8 @@ lasso_profile_context_set_response_status(LassoProfileContext *ctx,
}
gint
-lasso_profile_context_set_session(LassoProfileContext *ctx,
- LassoSession *session)
+lasso_profile_set_session(LassoProfile *ctx,
+ LassoSession *session)
{
g_return_val_if_fail(LASSO_IS_SESSION(session), -1);
@@ -206,8 +206,8 @@ lasso_profile_context_set_session(LassoProfileContext *ctx,
}
gint
-lasso_profile_context_set_session_from_dump(LassoProfileContext *ctx,
- const gchar *dump)
+lasso_profile_set_session_from_dump(LassoProfile *ctx,
+ const gchar *dump)
{
ctx->session = lasso_session_new_from_dump((gchar *)dump);
if (ctx->session == NULL) {
@@ -218,8 +218,8 @@ lasso_profile_context_set_session_from_dump(LassoProfileContext *ctx,
}
gint
-lasso_profile_context_set_identity(LassoProfileContext *ctx,
- LassoIdentity *identity)
+lasso_profile_set_identity(LassoProfile *ctx,
+ LassoIdentity *identity)
{
g_return_val_if_fail(LASSO_IS_IDENTITY(identity), -1);
@@ -229,8 +229,8 @@ lasso_profile_context_set_identity(LassoProfileContext *ctx,
}
gint
-lasso_profile_context_set_identity_from_dump(LassoProfileContext *ctx,
- const gchar *dump)
+lasso_profile_set_identity_from_dump(LassoProfile *ctx,
+ const gchar *dump)
{
ctx->identity = lasso_identity_new_from_dump((gchar *)dump);
if (ctx->identity == NULL) {
@@ -245,14 +245,14 @@ lasso_profile_context_set_identity_from_dump(LassoProfileContext *ctx,
/*****************************************************************************/
static void
-lasso_profile_context_dispose(LassoProfileContext *ctx)
+lasso_profile_dispose(LassoProfile *ctx)
{
if (ctx->private->dispose_has_run) {
return;
}
ctx->private->dispose_has_run = TRUE;
- debug("ProfileContext object 0x%x disposed ...\n", ctx);
+ debug("Profile object 0x%x disposed ...\n", ctx);
/* unref reference counted objects */
lasso_server_destroy(ctx->server);
@@ -266,9 +266,9 @@ lasso_profile_context_dispose(LassoProfileContext *ctx)
}
static void
-lasso_profile_context_finalize(LassoProfileContext *ctx)
+lasso_profile_finalize(LassoProfile *ctx)
{
- debug("ProfileContext object 0x%x finalized ...\n", ctx);
+ debug("Profile object 0x%x finalized ...\n", ctx);
g_free(ctx->nameIdentifier);
g_free(ctx->remote_providerID);
@@ -286,19 +286,19 @@ lasso_profile_context_finalize(LassoProfileContext *ctx)
/*****************************************************************************/
enum {
- LASSO_PROFILE_CONTEXT_SERVER = 1,
- LASSO_PROFILE_CONTEXT_IDENTITY,
- LASSO_PROFILE_CONTEXT_SESSION,
- LASSO_PROFILE_CONTEXT_PROVIDER_TYPE
+ LASSO_PROFILE_SERVER = 1,
+ LASSO_PROFILE_IDENTITY,
+ LASSO_PROFILE_SESSION,
+ LASSO_PROFILE_PROVIDER_TYPE
};
static void
-lasso_profile_context_instance_init(GTypeInstance *instance,
+lasso_profile_instance_init(GTypeInstance *instance,
gpointer g_class)
{
- LassoProfileContext *ctx = LASSO_PROFILE_CONTEXT(instance);
+ LassoProfile *ctx = LASSO_PROFILE(instance);
- ctx->private = g_new (LassoProfileContextPrivate, 1);
+ ctx->private = g_new (LassoProfilePrivate, 1);
ctx->private->dispose_has_run = FALSE;
ctx->server = NULL;
@@ -319,36 +319,36 @@ lasso_profile_context_instance_init(GTypeInstance *instance,
}
static void
-lasso_profile_context_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+lasso_profile_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- LassoProfileContext *self = LASSO_PROFILE_CONTEXT(object);
+ LassoProfile *self = LASSO_PROFILE(object);
switch (property_id) {
- case LASSO_PROFILE_CONTEXT_SERVER: {
+ case LASSO_PROFILE_SERVER: {
if (self->server) {
g_object_unref(self->server);
}
self->server = g_value_get_pointer (value);
}
break;
- case LASSO_PROFILE_CONTEXT_IDENTITY: {
+ case LASSO_PROFILE_IDENTITY: {
if (self->identity) {
g_object_unref(self->identity);
}
self->identity = g_value_get_pointer (value);
}
break;
- case LASSO_PROFILE_CONTEXT_SESSION: {
+ case LASSO_PROFILE_SESSION: {
if (self->session) {
g_object_unref(self->session);
}
self->session = g_value_get_pointer (value);
}
break;
- case LASSO_PROFILE_CONTEXT_PROVIDER_TYPE: {
+ case LASSO_PROFILE_PROVIDER_TYPE: {
self->provider_type = g_value_get_uint (value);
}
break;
@@ -360,31 +360,31 @@ lasso_profile_context_set_property (GObject *object,
}
static void
-lasso_profile_context_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+lasso_profile_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
}
static void
-lasso_profile_context_class_init(gpointer g_class,
- gpointer g_class_data)
+lasso_profile_class_init(gpointer g_class,
+ gpointer g_class_data)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
GParamSpec *pspec;
parent_class = g_type_class_peek_parent(g_class);
/* override parent class methods */
- gobject_class->set_property = lasso_profile_context_set_property;
- gobject_class->get_property = lasso_profile_context_get_property;
+ gobject_class->set_property = lasso_profile_set_property;
+ gobject_class->get_property = lasso_profile_get_property;
pspec = g_param_spec_pointer ("server",
"server metadata and keys/certs",
"Data of server",
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
- LASSO_PROFILE_CONTEXT_SERVER,
+ LASSO_PROFILE_SERVER,
pspec);
pspec = g_param_spec_pointer ("identity",
@@ -392,7 +392,7 @@ lasso_profile_context_class_init(gpointer g_class,
"User's federations",
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
- LASSO_PROFILE_CONTEXT_IDENTITY,
+ LASSO_PROFILE_IDENTITY,
pspec);
pspec = g_param_spec_pointer ("session",
@@ -400,7 +400,7 @@ lasso_profile_context_class_init(gpointer g_class,
"User's assertions",
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
- LASSO_PROFILE_CONTEXT_SESSION,
+ LASSO_PROFILE_SESSION,
pspec);
pspec = g_param_spec_uint ("provider_type",
@@ -411,50 +411,50 @@ lasso_profile_context_class_init(gpointer g_class,
0,
G_PARAM_READABLE | G_PARAM_WRITABLE);
g_object_class_install_property (gobject_class,
- LASSO_PROFILE_CONTEXT_PROVIDER_TYPE,
+ LASSO_PROFILE_PROVIDER_TYPE,
pspec);
- gobject_class->dispose = (void *)lasso_profile_context_dispose;
- gobject_class->finalize = (void *)lasso_profile_context_finalize;
+ gobject_class->dispose = (void *)lasso_profile_dispose;
+ gobject_class->finalize = (void *)lasso_profile_finalize;
}
-GType lasso_profile_context_get_type() {
+GType lasso_profile_get_type() {
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
- sizeof (LassoProfileContextClass),
+ sizeof (LassoProfileClass),
NULL,
NULL,
- (GClassInitFunc) lasso_profile_context_class_init,
+ (GClassInitFunc) lasso_profile_class_init,
NULL,
NULL,
- sizeof(LassoProfileContext),
+ sizeof(LassoProfile),
0,
- (GInstanceInitFunc) lasso_profile_context_instance_init,
+ (GInstanceInitFunc) lasso_profile_instance_init,
};
this_type = g_type_register_static(G_TYPE_OBJECT,
- "LassoProfileContext",
+ "LassoProfile",
&this_info, 0);
}
return this_type;
}
-LassoProfileContext*
-lasso_profile_context_new(LassoServer *server,
- LassoIdentity *identity,
- LassoSession *session)
+LassoProfile*
+lasso_profile_new(LassoServer *server,
+ LassoIdentity *identity,
+ LassoSession *session)
{
g_return_val_if_fail(server != NULL, NULL);
- LassoProfileContext *ctx;
+ LassoProfile *ctx;
- ctx = LASSO_PROFILE_CONTEXT(g_object_new(LASSO_TYPE_PROFILE_CONTEXT,
- "server", lasso_server_copy(server),
- "identity", lasso_identity_copy(identity),
- "session", lasso_session_copy(session),
- NULL));
+ ctx = LASSO_PROFILE(g_object_new(LASSO_TYPE_PROFILE,
+ "server", lasso_server_copy(server),
+ "identity", lasso_identity_copy(identity),
+ "session", lasso_session_copy(session),
+ NULL));
return (ctx);
}
diff --git a/lasso/id-ff/profile.h b/lasso/id-ff/profile.h
new file mode 100644
index 00000000..5ff3c7b7
--- /dev/null
+++ b/lasso/id-ff/profile.h
@@ -0,0 +1,144 @@
+/* $Id$
+ *
+ * Lasso - A free implementation of the Liberty Alliance specifications.
+ *
+ * Copyright (C) 2004 Entr'ouvert
+ * http://lasso.entrouvert.org
+ *
+ * Authors: Nicolas Clapies <nclapies@entrouvert.com>
+ * Valery Febvre <vfebvre@easter-eggs.com>
+ *
+ * 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_PROFILE_H__
+#define __LASSO_PROFILE_H__
+
+#ifdef __cplusplus
+extern "C" {
+
+#endif /* __cplusplus */
+
+#include <lasso/xml/strings.h>
+#include <lasso/xml/tools.h>
+
+#include <lasso/environs/server.h>
+#include <lasso/environs/identity.h>
+#include <lasso/environs/session.h>
+
+#define LASSO_TYPE_PROFILE (lasso_profile_get_type())
+#define LASSO_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_PROFILE, LassoProfile))
+#define LASSO_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_PROFILE, LassoProfileClass))
+#define LASSO_IS_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_PROFILE))
+#define LASSO_IS_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_PROFILE))
+#define LASSO_PROFILE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_PROFILE, LassoProfileClass))
+
+typedef struct _LassoProfile LassoProfile;
+typedef struct _LassoProfileClass LassoProfileClass;
+typedef struct _LassoProfilePrivate LassoProfilePrivate;
+
+/* Request types (used by SOAP endpoint) */
+typedef enum {
+ lassoRequestTypeLogin = 1,
+ lassoRequestTypeLogout,
+ lassoRequestTypeFederationTermination,
+ lassoRequestTypeRegisterNameIdentifier,
+ lassoRequestTypeNameIdentifierMapping,
+} lassoRequestTypes;
+
+typedef enum {
+ lassoHttpMethodGet = 1,
+ lassoHttpMethodPost,
+ lassoHttpMethodRedirect,
+ lassoHttpMethodSoap,
+} lassoHttpMethods;
+
+typedef enum {
+ lassoMessageTypeNone = 0,
+ lassoMessageTypeAuthnRequest,
+ lassoMessageTypeAuthnResponse,
+ lassoMessageTypeRequest,
+ lassoMessageTypeResponse,
+ lassoMessageTypeArtifact,
+} lassoMessageTypes;
+
+struct _LassoProfile {
+ GObject parent;
+
+ /*< public >*/
+ LassoServer *server;
+ LassoIdentity *identity;
+ LassoSession *session;
+
+ LassoNode *request;
+ LassoNode *response;
+
+ gchar *nameIdentifier;
+
+ gchar *remote_providerID;
+
+ gchar *msg_url;
+ gchar *msg_body;
+ gchar *msg_relayState;
+
+ gboolean identity_is_durty;
+ gboolean session_is_durty;
+
+ /*< private >*/
+ LassoProfilePrivate *private;
+ lassoMessageTypes request_type;
+ lassoMessageTypes response_type;
+ lassoProviderTypes provider_type;
+};
+
+struct _LassoProfileClass {
+ GObjectClass parent;
+};
+
+LASSO_EXPORT gint lasso_profile_get_request_type_from_soap_msg (gchar *soap);
+
+
+LASSO_EXPORT GType lasso_profile_get_type (void);
+
+LASSO_EXPORT LassoProfile* lasso_profile_new (LassoServer *server,
+ LassoIdentity *identity,
+ LassoSession *session);
+
+LASSO_EXPORT gchar* lasso_profile_dump (LassoProfile *ctx,
+ const gchar *name);
+
+LASSO_EXPORT gint lasso_profile_set_remote_providerID (LassoProfile *ctx,
+ gchar *providerID);
+
+LASSO_EXPORT void lasso_profile_set_response_status (LassoProfile *ctx,
+ const gchar *statusCodeValue);
+
+LASSO_EXPORT gint lasso_profile_set_session (LassoProfile *ctx,
+ LassoSession *session);
+
+LASSO_EXPORT gint lasso_profile_set_session_from_dump (LassoProfile *ctx,
+ const gchar *dump);
+
+LASSO_EXPORT gint lasso_profile_set_identity (LassoProfile *ctx,
+ LassoIdentity *identity);
+
+LASSO_EXPORT gint lasso_profile_set_identity_from_dump (LassoProfile *ctx,
+ const gchar *dump);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LASSO_PROFILE_H__ */
diff --git a/lasso/id-ff/profile_context.h b/lasso/id-ff/profile_context.h
deleted file mode 100644
index 0c634187..00000000
--- a/lasso/id-ff/profile_context.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* $Id$
- *
- * Lasso - A free implementation of the Liberty Alliance specifications.
- *
- * Copyright (C) 2004 Entr'ouvert
- * http://lasso.entrouvert.org
- *
- * Authors: Nicolas Clapies <nclapies@entrouvert.com>
- * Valery Febvre <vfebvre@easter-eggs.com>
- *
- * 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_PROFILE_CONTEXT_H__
-#define __LASSO_PROFILE_CONTEXT_H__
-
-#ifdef __cplusplus
-extern "C" {
-
-#endif /* __cplusplus */
-
-#include <lasso/xml/strings.h>
-#include <lasso/xml/tools.h>
-
-#include <lasso/environs/server.h>
-#include <lasso/environs/identity.h>
-#include <lasso/environs/session.h>
-
-#define LASSO_TYPE_PROFILE_CONTEXT (lasso_profile_context_get_type())
-#define LASSO_PROFILE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_PROFILE_CONTEXT, LassoProfileContext))
-#define LASSO_PROFILE_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_PROFILE_CONTEXT, LassoProfileContextClass))
-#define LASSO_IS_PROFILE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_PROFILE_CONTEXT))
-#define LASSO_IS_PROFILE_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_PROFILE_CONTEXT))
-#define LASSO_PROFILE_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_PROFILE_CONTEXT, LassoProfileContextClass))
-
-typedef struct _LassoProfileContext LassoProfileContext;
-typedef struct _LassoProfileContextClass LassoProfileContextClass;
-typedef struct _LassoProfileContextPrivate LassoProfileContextPrivate;
-
-/* Request types (used by SOAP endpoint) */
-typedef enum {
- lassoRequestTypeLogin = 1,
- lassoRequestTypeLogout,
- lassoRequestTypeFederationTermination,
- lassoRequestTypeRegisterNameIdentifier,
- lassoRequestTypeNameIdentifierMapping,
-} lassoRequestTypes;
-
-typedef enum {
- lassoHttpMethodGet = 1,
- lassoHttpMethodPost,
- lassoHttpMethodRedirect,
- lassoHttpMethodSoap,
-} lassoHttpMethods;
-
-typedef enum {
- lassoMessageTypeNone = 0,
- lassoMessageTypeAuthnRequest,
- lassoMessageTypeAuthnResponse,
- lassoMessageTypeRequest,
- lassoMessageTypeResponse,
- lassoMessageTypeArtifact,
-} lassoMessageTypes;
-
-struct _LassoProfileContext {
- GObject parent;
-
- /*< public >*/
- LassoServer *server;
- LassoIdentity *identity;
- LassoSession *session;
-
- LassoNode *request;
- LassoNode *response;
-
- gchar *nameIdentifier;
-
- gchar *remote_providerID;
-
- gchar *msg_url;
- gchar *msg_body;
- gchar *msg_relayState;
-
- gboolean identity_is_durty;
- gboolean session_is_durty;
-
- /*< private >*/
- LassoProfileContextPrivate *private;
- lassoMessageTypes request_type;
- lassoMessageTypes response_type;
- lassoProviderTypes provider_type;
-};
-
-struct _LassoProfileContextClass {
- GObjectClass parent;
-};
-
-LASSO_EXPORT gint lasso_profile_context_get_request_type_from_soap_msg (gchar *soap);
-
-
-LASSO_EXPORT GType lasso_profile_context_get_type (void);
-
-LASSO_EXPORT LassoProfileContext* lasso_profile_context_new (LassoServer *server,
- LassoIdentity *identity,
- LassoSession *session);
-
-LASSO_EXPORT gchar* lasso_profile_context_dump (LassoProfileContext *ctx,
- const gchar *name);
-
-LASSO_EXPORT gint lasso_profile_context_set_remote_providerID (LassoProfileContext *ctx,
- gchar *providerID);
-
-LASSO_EXPORT void lasso_profile_context_set_response_status (LassoProfileContext *ctx,
- const gchar *statusCodeValue);
-
-LASSO_EXPORT gint lasso_profile_context_set_session (LassoProfileContext *ctx,
- LassoSession *session);
-
-LASSO_EXPORT gint lasso_profile_context_set_session_from_dump (LassoProfileContext *ctx,
- const gchar *dump);
-
-LASSO_EXPORT gint lasso_profile_context_set_identity (LassoProfileContext *ctx,
- LassoIdentity *identity);
-
-LASSO_EXPORT gint lasso_profile_context_set_identity_from_dump (LassoProfileContext *ctx,
- const gchar *dump);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __LASSO_PROFILE_CONTEXT_H__ */
diff --git a/lasso/id-ff/register_name_identifier.c b/lasso/id-ff/register_name_identifier.c
index 6fe73937..5e19c89f 100644
--- a/lasso/id-ff/register_name_identifier.c
+++ b/lasso/id-ff/register_name_identifier.c
@@ -46,43 +46,45 @@ lasso_register_name_identifier_dump(LassoRegisterNameIdentifier *register_name_i
gint
lasso_register_name_identifier_build_request_msg(LassoRegisterNameIdentifier *register_name_identifier)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoProvider *provider;
xmlChar *protocolProfile;
g_return_val_if_fail(LASSO_IS_REGISTER_NAME_IDENTIFIER(register_name_identifier), -1);
- profileContext = LASSO_PROFILE_CONTEXT(register_name_identifier);
+ profile = LASSO_PROFILE(register_name_identifier);
- provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID);
- if(provider==NULL){
- message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profileContext->remote_providerID);
+ provider = lasso_server_get_provider(profile->server, profile->remote_providerID);
+ if(provider == NULL) {
+ message(G_LOG_LEVEL_ERROR, "Provider %s not found\n", profile->remote_providerID);
return(-2);
}
/* get the prototocol profile of the register_name_identifier */
protocolProfile = lasso_provider_get_registerNameIdentifierProtocolProfile(provider);
- if(protocolProfile==NULL){
+ if(protocolProfile == NULL){
message(G_LOG_LEVEL_ERROR, "Register_Name_Identifier Protocol profile not found\n");
return(-3);
}
- if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileRniIdpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileRniSpSoap)){
- profileContext->request_type = lassoHttpMethodSoap;
+ if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileRniIdpSoap) || \
+ xmlStrEqual(protocolProfile, lassoLibProtocolProfileRniSpSoap)) {
+ profile->request_type = lassoHttpMethodSoap;
/* sign the request message */
- lasso_samlp_request_abstract_set_signature(LASSO_SAMLP_REQUEST_ABSTRACT(profileContext->request),
- profileContext->server->signature_method,
- profileContext->server->private_key,
- profileContext->server->certificate);
+ lasso_samlp_request_abstract_set_signature(LASSO_SAMLP_REQUEST_ABSTRACT(profile->request),
+ profile->server->signature_method,
+ profile->server->private_key,
+ profile->server->certificate);
- profileContext->msg_url = lasso_provider_get_soapEndpoint(provider);
- profileContext->msg_body = lasso_node_export_to_soap(profileContext->request);
+ profile->msg_url = lasso_provider_get_soapEndpoint(provider);
+ profile->msg_body = lasso_node_export_to_soap(profile->request);
}
- else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileRniIdpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileRniSpHttp)){
+ else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileRniIdpHttp) || \
+ xmlStrEqual(protocolProfile,lassoLibProtocolProfileRniSpHttp)) {
debug("Building a http get request message\n");
}
- else{
+ else {
message(G_LOG_LEVEL_ERROR, "Invalid protocol Profile for register name identifier\n");
}
@@ -92,32 +94,34 @@ lasso_register_name_identifier_build_request_msg(LassoRegisterNameIdentifier *re
gint
lasso_register_name_identifier_build_response_msg(LassoRegisterNameIdentifier *register_name_identifier)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoProvider *provider;
xmlChar *protocolProfile;
g_return_val_if_fail(LASSO_IS_REGISTER_NAME_IDENTIFIER(register_name_identifier), -1);
- profileContext = LASSO_PROFILE_CONTEXT(register_name_identifier);
+ profile = LASSO_PROFILE(register_name_identifier);
- provider = lasso_server_get_provider(profileContext->server, profileContext->remote_providerID);
- if(provider==NULL){
- message(G_LOG_LEVEL_ERROR, "Provider not found (ProviderID = %s)\n", profileContext->remote_providerID);
+ provider = lasso_server_get_provider(profile->server, profile->remote_providerID);
+ if(provider == NULL) {
+ message(G_LOG_LEVEL_ERROR, "Provider not found (ProviderID = %s)\n", profile->remote_providerID);
return(-2);
}
protocolProfile = lasso_provider_get_registerNameIdentifierProtocolProfile(provider);
- if(protocolProfile==NULL){
+ if(protocolProfile == NULL) {
message(G_LOG_LEVEL_ERROR, "Register name identifier protocol profile not found\n");
return(-3);
}
- if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)){
+ if(xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap) || \
+ xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloIdpSoap)) {
debug("building a soap response message\n");
- profileContext->msg_url = lasso_provider_get_registerNameIdentifierServiceURL(provider);
- profileContext->msg_body = lasso_node_export_to_soap(profileContext->response);
+ profile->msg_url = lasso_provider_get_registerNameIdentifierServiceURL(provider);
+ profile->msg_body = lasso_node_export_to_soap(profile->response);
}
- else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp)||xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)){
+ else if(xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp) || \
+ xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)) {
debug("building a http get response message\n");
}
@@ -134,7 +138,7 @@ gint
lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *register_name_identifier,
gchar *remote_providerID)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoNode *nameIdentifier_node;
LassoFederation *federation;
@@ -144,34 +148,34 @@ lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *registe
g_return_val_if_fail(LASSO_IS_REGISTER_NAME_IDENTIFIER(register_name_identifier), -1);
- profileContext = LASSO_PROFILE_CONTEXT(register_name_identifier);
+ profile = LASSO_PROFILE(register_name_identifier);
if(remote_providerID == NULL) {
message(G_LOG_LEVEL_INFO, "No remote provider id, get the next federation peer provider id\n");
- profileContext->remote_providerID = lasso_identity_get_next_federation_remote_providerID(profileContext->identity);
+ profile->remote_providerID = lasso_identity_get_next_federation_remote_providerID(profile->identity);
}
else {
message(G_LOG_LEVEL_INFO, "A remote provider id for register name identifier request : %s\n", remote_providerID);
- profileContext->remote_providerID = g_strdup(remote_providerID);
+ profile->remote_providerID = g_strdup(remote_providerID);
}
- if(profileContext->remote_providerID == NULL) {
+ if(profile->remote_providerID == NULL) {
message(G_LOG_LEVEL_ERROR, "No provider id for init request\n");
return(-2);
}
/* get federation */
- federation = lasso_identity_get_federation(profileContext->identity, profileContext->remote_providerID);
+ federation = lasso_identity_get_federation(profile->identity, profile->remote_providerID);
if(federation == NULL) {
message(G_LOG_LEVEL_ERROR, "Federation not found\n");
return(-3);
}
printf("plop\n");
- switch(profileContext->provider_type){
+ switch(profile->provider_type){
case lassoProviderTypeSp:
debug("Service Provider\n");
/* set the new name identifier */
spNameIdentifier = lasso_build_unique_id(32);
- spNameQualifier = g_strdup(profileContext->remote_providerID);
+ spNameQualifier = g_strdup(profile->remote_providerID);
spFormat = "federated";
/* set the old name identifier */
@@ -205,7 +209,7 @@ lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *registe
case lassoProviderTypeIdp:
debug("Federation Provider\n");
idpNameIdentifier = lasso_build_unique_id(32);
- idpNameQualifier = g_strdup(profileContext->remote_providerID);
+ idpNameQualifier = g_strdup(profile->remote_providerID);
idpFormat = "federated";
nameIdentifier_node = lasso_federation_get_local_nameIdentifier(federation);
@@ -227,7 +231,7 @@ lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *registe
break;
default:
- message(G_LOG_LEVEL_ERROR, "Invalid provider type (%d)\n", profileContext->provider_type);
+ message(G_LOG_LEVEL_ERROR, "Invalid provider type (%d)\n", profile->provider_type);
return(-5);
}
@@ -235,18 +239,18 @@ lasso_register_name_identifier_init_request(LassoRegisterNameIdentifier *registe
debug("sp name identifier : %s, sp name qualifier : %s, sp format : %s\n", spNameIdentifier, spNameQualifier, spFormat);
debug("idp name identifier : %s, idp name qualifier : %s, idp format : %s\n", idpNameIdentifier, idpNameQualifier, idpFormat);
- profileContext->request = lasso_register_name_identifier_request_new(profileContext->server->providerID,
- idpNameQualifier,
- idpNameQualifier,
- idpFormat,
- spNameIdentifier,
- spNameQualifier,
- spFormat,
- oldNameIdentifier,
- oldNameQualifier,
- oldFormat);
-
- if(profileContext->request==NULL){
+ profile->request = lasso_register_name_identifier_request_new(profile->server->providerID,
+ idpNameQualifier,
+ idpNameQualifier,
+ idpFormat,
+ spNameIdentifier,
+ spNameQualifier,
+ spFormat,
+ oldNameIdentifier,
+ oldNameQualifier,
+ oldFormat);
+
+ if(profile->request == NULL) {
message(G_LOG_LEVEL_ERROR, "Error while creating the request\n");
return(-6);
}
@@ -258,21 +262,21 @@ gint lasso_register_name_identifier_load_request_msg(LassoRegisterNameIdentifier
gchar *request_msg,
lassoHttpMethods request_method)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
g_return_val_if_fail(LASSO_IS_REGISTER_NAME_IDENTIFIER(register_name_identifier), -1);
g_return_val_if_fail(request_msg!=NULL, -2);
- profileContext = LASSO_PROFILE_CONTEXT(register_name_identifier);
+ profile = LASSO_PROFILE(register_name_identifier);
- switch(request_method){
+ switch(request_method) {
case lassoHttpMethodSoap:
debug("Build a register name identifier request from soap msg\n");
- profileContext->request = lasso_register_name_identifier_request_new_from_export(request_msg, lassoNodeExportTypeSoap);
+ profile->request = lasso_register_name_identifier_request_new_from_export(request_msg, lassoNodeExportTypeSoap);
break;
case lassoHttpMethodRedirect:
debug("Build a register name identifier request from query msg\n");
- profileContext->request = lasso_register_name_identifier_request_new_from_export(request_msg, lassoNodeExportTypeQuery);
+ profile->request = lasso_register_name_identifier_request_new_from_export(request_msg, lassoNodeExportTypeQuery);
break;
case lassoHttpMethodGet:
debug("TODO, implement the get method\n");
@@ -281,18 +285,18 @@ gint lasso_register_name_identifier_load_request_msg(LassoRegisterNameIdentifier
message(G_LOG_LEVEL_ERROR, "Invalid request method\n");
return(-3);
}
- if(profileContext->request==NULL){
+ if(profile->request == NULL) {
message(G_LOG_LEVEL_ERROR, "Error while building the request from msg\n");
return(-4);
}
/* get the NameIdentifier to load identity dump */
- profileContext->nameIdentifier = lasso_node_get_child_content(profileContext->request,
- "NameIdentifier", NULL);
+ profile->nameIdentifier = lasso_node_get_child_content(profile->request,
+ "NameIdentifier", NULL);
/* get the RelayState */
- profileContext->msg_relayState = lasso_node_get_child_content(profileContext->request,
- "RelayState", NULL);
+ profile->msg_relayState = lasso_node_get_child_content(profile->request,
+ "RelayState", NULL);
return(0);
}
@@ -300,7 +304,7 @@ gint lasso_register_name_identifier_load_request_msg(LassoRegisterNameIdentifier
gint
lasso_register_name_identifier_process_request(LassoRegisterNameIdentifier *register_name_identifier)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
LassoFederation *federation;
LassoNode *nameIdentifier, *assertion;
LassoNode *statusCode;
@@ -309,40 +313,40 @@ lasso_register_name_identifier_process_request(LassoRegisterNameIdentifier *regi
g_return_val_if_fail(LASSO_IS_REGISTER_NAME_IDENTIFIER(register_name_identifier), -1);
- profileContext = LASSO_PROFILE_CONTEXT(register_name_identifier);
+ profile = LASSO_PROFILE(register_name_identifier);
/* set the remote provider id from the request */
- remote_providerID = lasso_node_get_child_content(profileContext->request, "ProviderID", NULL);
- profileContext->remote_providerID = remote_providerID;
+ remote_providerID = lasso_node_get_child_content(profile->request, "ProviderID", NULL);
+ profile->remote_providerID = remote_providerID;
/* set RegisterNameIdentifierResponse */
- profileContext->response = lasso_register_name_identifier_response_new(profileContext->server->providerID,
- lassoSamlStatusCodeSuccess,
- profileContext->request);
+ profile->response = lasso_register_name_identifier_response_new(profile->server->providerID,
+ lassoSamlStatusCodeSuccess,
+ profile->request);
- if(profileContext->response==NULL){
+ if(profile->response == NULL) {
message(G_LOG_LEVEL_ERROR, "Error while building response\n");
return(-4);
}
- statusCode = lasso_node_get_child(profileContext->response, "StatusCode", NULL);
+ statusCode = lasso_node_get_child(profile->response, "StatusCode", NULL);
statusCode_class = LASSO_NODE_GET_CLASS(statusCode);
- nameIdentifier = lasso_node_get_child(profileContext->request, "NameIdentifier", NULL);
- if(nameIdentifier==NULL){
+ nameIdentifier = lasso_node_get_child(profile->request, "NameIdentifier", NULL);
+ if(nameIdentifier == NULL) {
message(G_LOG_LEVEL_ERROR, "No name identifier found in register_name_identifier request\n");
statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist);
return(-5);
}
- remote_providerID = lasso_node_get_child_content(profileContext->request, "ProviderID", NULL);
- if(remote_providerID==NULL){
+ remote_providerID = lasso_node_get_child_content(profile->request, "ProviderID", NULL);
+ if(remote_providerID == NULL) {
message(G_LOG_LEVEL_ERROR, "No provider id found in register_name_identifier request\n");
return(-6);
}
/* Verify federation */
- federation = lasso_identity_get_federation(profileContext->identity, remote_providerID);
+ federation = lasso_identity_get_federation(profile->identity, remote_providerID);
if(federation == NULL) {
message(G_LOG_LEVEL_WARNING, "No federation for %s\n", remote_providerID);
statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeFederationDoesNotExist);
@@ -356,8 +360,8 @@ lasso_register_name_identifier_process_request(LassoRegisterNameIdentifier *regi
}
/* verify authentication (if ok, delete assertion) */
- assertion = lasso_session_get_assertion(profileContext->session, remote_providerID);
- if(assertion==NULL){
+ assertion = lasso_session_get_assertion(profile->session, remote_providerID);
+ if(assertion == NULL) {
message(G_LOG_LEVEL_WARNING, "%s has no assertion\n", remote_providerID);
statusCode_class->set_prop(statusCode, "Value", lassoSamlStatusCodeRequestDenied);
lasso_node_destroy(assertion);
@@ -372,34 +376,34 @@ lasso_register_name_identifier_process_response_msg(LassoRegisterNameIdentifier
gchar *response_msg,
lassoHttpMethods response_method)
{
- LassoProfileContext *profileContext;
+ LassoProfile *profile;
xmlChar *statusCodeValue;
LassoNode *statusCode;
GError *err = NULL;
gint ret = 0;
g_return_val_if_fail(LASSO_IS_REGISTER_NAME_IDENTIFIER(register_name_identifier), -1);
- g_return_val_if_fail(response_msg!=NULL, -2);
+ g_return_val_if_fail(response_msg != NULL, -2);
- profileContext = LASSO_PROFILE_CONTEXT(register_name_identifier);
+ profile = LASSO_PROFILE(register_name_identifier);
/* parse RegisterNameIdentifierResponse */
switch(response_method){
case lassoHttpMethodSoap:
- profileContext->response = lasso_register_name_identifier_response_new_from_export(response_msg, lassoNodeExportTypeSoap);
+ profile->response = lasso_register_name_identifier_response_new_from_export(response_msg, lassoNodeExportTypeSoap);
break;
case lassoHttpMethodRedirect:
- profileContext->response = lasso_register_name_identifier_response_new_from_export(response_msg, lassoNodeExportTypeQuery);
+ profile->response = lasso_register_name_identifier_response_new_from_export(response_msg, lassoNodeExportTypeQuery);
break;
default:
message(G_LOG_LEVEL_ERROR, "Unknown response method\n");
return(-3);
}
- statusCode = lasso_node_get_child(profileContext->response, "StatusCode", NULL);
+ statusCode = lasso_node_get_child(profile->response, "StatusCode", NULL);
statusCodeValue = lasso_node_get_attr_value(statusCode, "Value", &err);
if (err == NULL) {
- if(!xmlStrEqual(statusCodeValue, lassoSamlStatusCodeSuccess)){
+ if(!xmlStrEqual(statusCodeValue, lassoSamlStatusCodeSuccess)) {
return(-4);
}
}
@@ -459,7 +463,7 @@ GType lasso_register_name_identifier_get_type() {
(GInstanceInitFunc) lasso_register_name_identifier_instance_init,
};
- this_type = g_type_register_static(LASSO_TYPE_PROFILE_CONTEXT,
+ this_type = g_type_register_static(LASSO_TYPE_PROFILE,
"LassoRegisterNameIdentifier",
&this_info, 0);
}
diff --git a/lasso/id-ff/register_name_identifier.h b/lasso/id-ff/register_name_identifier.h
index 63bf4b9b..ec2517e6 100644
--- a/lasso/id-ff/register_name_identifier.h
+++ b/lasso/id-ff/register_name_identifier.h
@@ -30,7 +30,7 @@
extern "C" {
#endif /* __cplusplus */
-#include <lasso/environs/profile_context.h>
+#include <lasso/environs/profile.h>
#include <lasso/protocols/register_name_identifier_request.h>
#include <lasso/protocols/register_name_identifier_response.h>
@@ -46,13 +46,13 @@ typedef struct _LassoRegisterNameIdentifier LassoRegisterNameIdentifier;
typedef struct _LassoRegisterNameIdentifierClass LassoRegisterNameIdentifierClass;
struct _LassoRegisterNameIdentifier {
- LassoProfileContext parent;
+ LassoProfile parent;
/*< private >*/
};
struct _LassoRegisterNameIdentifierClass {
- LassoNodeClass parent;
+ LassoProfileClass parent;
};