From 46738d03eacf3b0368e50674194f6f05cae2cddf Mon Sep 17 00:00:00 2001 From: Nicolas Clapies Date: Wed, 21 Jul 2004 14:11:09 +0000 Subject: update of federation termination notification --- lasso/id-ff/federation_termination.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'lasso/id-ff/federation_termination.c') 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); } -- cgit