summaryrefslogtreecommitdiffstats
path: root/lasso/id-ff/federation_termination.c
diff options
context:
space:
mode:
authorNicolas Clapies <nclapies@entrouvert.com>2004-07-21 14:11:09 +0000
committerNicolas Clapies <nclapies@entrouvert.com>2004-07-21 14:11:09 +0000
commit46738d03eacf3b0368e50674194f6f05cae2cddf (patch)
tree5802e13b94ffc61c5f612276835d96a7fa8446a9 /lasso/id-ff/federation_termination.c
parentb7cfb5c758c898377a08b368e156bae4d1820b1b (diff)
downloadlasso-46738d03eacf3b0368e50674194f6f05cae2cddf.tar.gz
lasso-46738d03eacf3b0368e50674194f6f05cae2cddf.tar.xz
lasso-46738d03eacf3b0368e50674194f6f05cae2cddf.zip
update of federation termination notification
Diffstat (limited to 'lasso/id-ff/federation_termination.c')
-rw-r--r--lasso/id-ff/federation_termination.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/lasso/id-ff/federation_termination.c b/lasso/id-ff/federation_termination.c
index a50985a1..9bf31509 100644
--- a/lasso/id-ff/federation_termination.c
+++ b/lasso/id-ff/federation_termination.c
@@ -109,14 +109,19 @@ lasso_federation_termination_init_notification(LassoFederationTermination *defed
profileContext = LASSO_PROFILE_CONTEXT(defederation);
if(remote_providerID==NULL){
- debug(INFO, "No remote provider id, get the issuer of the first authentication assertion\n");
- profileContext->remote_providerID = lasso_user_get_next_assertion_remote_providerID(profileContext->user);
+ debug(INFO, "No remote provider id, get the remote provider id of the first identity\n");
+ profileContext->remote_providerID = lasso_user_get_next_identity_remote_providerID(profileContext->user);
}
else{
debug(INFO, "A remote provider id for defederation notification : %s\n", remote_providerID);
profileContext->remote_providerID = g_strdup(remote_providerID);
}
+ if(profileContext->remote_providerID==NULL){
+ debug(ERROR, "No provider id for init notification\n");
+ return(-2);
+ }
+
/* get identity */
identity = lasso_user_get_identity(profileContext->user, profileContext->remote_providerID);
if(identity==NULL){
@@ -128,8 +133,9 @@ lasso_federation_termination_init_notification(LassoFederationTermination *defed
switch(profileContext->provider_type){
case lassoProviderTypeSp:
nameIdentifier = LASSO_NODE(lasso_identity_get_local_nameIdentifier(identity));
- if(!nameIdentifier)
+ if(!nameIdentifier){
nameIdentifier = LASSO_NODE(lasso_identity_get_remote_nameIdentifier(identity));
+ }
break;
case lassoProviderTypeIdp:
nameIdentifier = LASSO_NODE(lasso_identity_get_remote_nameIdentifier(identity));
@@ -180,11 +186,11 @@ lasso_federation_termination_process_notification_msg(LassoFederationTermination
switch(request_method){
case lassoHttpMethodSoap:
debug(DEBUG, "Process a federation termination notification soap msg\n");
- profileContext->request = lasso_federation_termination_notification_new_from_soap(request_msg);
+ profileContext->request = lasso_federation_termination_notification_new_from_export(request_msg, lassoNodeExportTypeSoap);
break;
case lassoHttpMethodRedirect:
debug(DEBUG, "Process a federation termination notification query msg\n");
- profileContext->request = lasso_federation_termination_notification_new_from_query(request_msg);
+ profileContext->request = lasso_federation_termination_notification_new_from_export(request_msg, lassoNodeExportTypeQuery);
break;
case lassoHttpMethodGet:
debug(WARNING, "Implement the get federation termination notification method\n");
@@ -193,6 +199,10 @@ lasso_federation_termination_process_notification_msg(LassoFederationTermination
debug(ERROR, "Unknown request method (%d)\n", request_method);
return(-1);
}
+ if(profileContext->request==NULL){
+ debug(ERROR, "Error While building the request from msg\n");
+ return(-1);
+ }
/* set the remote provider id from the request */
remote_providerID = lasso_node_get_child_content(profileContext->request, "ProviderID", NULL);
@@ -204,20 +214,27 @@ lasso_federation_termination_process_notification_msg(LassoFederationTermination
return(-2);
}
- remote_providerID = lasso_node_get_child_content(profileContext->request, "ProviderID", NULL);
-
/* Verify federation */
+ if(profileContext->user==NULL){
+ debug(ERROR, "User environ not found\n");
+ return(-3);
+ }
+
identity = lasso_user_get_identity(profileContext->user, remote_providerID);
if(identity==NULL){
debug(WARNING, "No identity for %s\n", remote_providerID);
- return(-3);
+ return(-4);
}
if(lasso_identity_verify_nameIdentifier(identity, nameIdentifier)==FALSE){
debug(WARNING, "No name identifier for %s\n", remote_providerID);
- return(-4);
+ return(-5);
}
+ /* remove federation of the remote provider */
+ lasso_identity_remove_remote_nameIdentifier(identity);
+ debug(INFO, "Remote name identifier removed from federation with %s\n", profileContext->remote_providerID);
+
return(0);
}