Revision: 1795
Author: olavmrk
Date: Mon Sep 28 05:16:10 2009
Log: iframe-logout: Improvements in behaviour when one of the SPs doesn't  
support SLO.

Fixes issue 187
http://code.google.com/p/simplesamlphp/source/detail?r=1795

Modified:
  /trunk/templates/logout-iframe.php
  /trunk/www/saml2/idp/SingleLogoutServiceiFrame.php
  /trunk/www/saml2/idp/idpInitSingleLogoutServiceiFrame.php

=======================================
--- /trunk/templates/logout-iframe.php  Tue Mar  3 04:09:56 2009
+++ /trunk/templates/logout-iframe.php  Mon Sep 28 05:16:10 2009
@@ -50,6 +50,7 @@
        $("#hiddeniframecontainer").html("' . str_replace('"', '\"',  
$iframehtml) . '");
        $("table#slostatustable  
tr.onhold").removeClass("onhold").addClass("inprogress");
  /*    $("div.completedButWarnings").show();  */
+' . ($iframehtml === '' ? 'sendResponse();' : '') . '
        setTimeout("toolong()", 16000);
  }

@@ -64,7 +65,7 @@
  function slocompleted() {
  /*    $("div.completedButWarnings").show(); */
        $("div#interrupt").hide();
-' . ($nologoutSPs ? ' ' : 'setTimeout("sendResponse()", 2000);') . '
+        setTimeout("sendResponse()", 2000);
  }

  function sendResponse() {
=======================================
--- /trunk/www/saml2/idp/SingleLogoutServiceiFrame.php  Thu Sep 24 01:38:14  
2009
+++ /trunk/www/saml2/idp/SingleLogoutServiceiFrame.php  Mon Sep 28 05:16:10  
2009
@@ -104,7 +104,30 @@
        $templistofsps = 
$session->get_sp_list(SimpleSAML_Session::STATE_ONLINE);
        $listofsps = array();
        foreach ($templistofsps AS $spentityid) {
-               if (!empty($_COOKIE['spstate-' . sha1($spentityid)])) 
$listofsps[] =  
$spentityid;
+               if (!empty($_COOKIE['spstate-' . sha1($spentityid)])) {
+                       $listofsps[] = $spentityid;
+                       continue;
+               }
+
+               try {
+                       $spmetadata = $metadata->getMetaData($spentityid, 
'saml20-sp-remote');
+               } catch (Exception $e) {
+                       /*
+                        * For some reason, the metadata for this SP is no 
longer available.  
Most
+                        * likely it was deleted from the IdP while the user 
had a session to  
it.
+                        * In any case - skip this SP.
+                        */
+                       $listofsps[] = $spentityid;
+                       continue;
+               }
+
+               if (!isset($spmetadata['SingleLogoutService'])) {
+                       /* No logout endpoint. */
+                       $listofsps[] = $spentityid;
+                       continue;
+               }
+
+               /* This SP isn't ready yet. */
        }
        SimpleSAML_Logger::debug('SAML2.0 - IdP.SingleLogoutServiceiFrame:  
templistofsps ' . join(',', $templistofsps));
        SimpleSAML_Logger::debug('SAML2.0 - IdP.SingleLogoutServiceiFrame:      
listofsps ' . join(',', $listofsps));
=======================================
--- /trunk/www/saml2/idp/idpInitSingleLogoutServiceiFrame.php   Fri Aug 14  
04:07:44 2009
+++ /trunk/www/saml2/idp/idpInitSingleLogoutServiceiFrame.php   Mon Sep 28  
05:16:10 2009
@@ -97,7 +97,30 @@
        $templistofsps = 
$session->get_sp_list(SimpleSAML_Session::STATE_ONLINE);
        $listofsps = array();
        foreach ($templistofsps AS $spentityid) {
-               if (!empty($_COOKIE['spstate-' . sha1($spentityid)])) 
$listofsps[] =  
$spentityid;
+               if (!empty($_COOKIE['spstate-' . sha1($spentityid)])) {
+                       $listofsps[] = $spentityid;
+                       continue;
+               }
+
+               try {
+                       $spmetadata = $metadata->getMetaData($spentityid, 
'saml20-sp-remote');
+               } catch (Exception $e) {
+                       /*
+                        * For some reason, the metadata for this SP is no 
longer available.  
Most
+                        * likely it was deleted from the IdP while the user 
had a session to  
it.
+                        * In any case - skip this SP.
+                        */
+                       $listofsps[] = $spentityid;
+                       continue;
+               }
+
+               if (!isset($spmetadata['SingleLogoutService'])) {
+                       /* No logout endpoint. */
+                       $listofsps[] = $spentityid;
+                       continue;
+               }
+
+               /* This SP isn't ready yet. */
        }
        SimpleSAML_Logger::debug('SAML2.0 - IdP.SingleLogoutServiceiFrame:  
templistofsps ' . join(',', $templistofsps));
        SimpleSAML_Logger::debug('SAML2.0 - IdP.SingleLogoutServiceiFrame:      
listofsps ' . join(',', $listofsps));
@@ -224,7 +247,7 @@
  /*
   * If the user is not logged into any other SPs.
   */
-if (count($sparray) === 0) {
+if (count($sparray) + count($sparrayNoLogout) === 0) {
        SimpleSAML_Utilities::redirect($relayState);
        exit;
  }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simplesamlphp-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to