Revision: 2186
Author: hans.zandbelt
Date: Wed Feb 17 11:13:41 2010
Log: fixes for global logout so the right $idp variable is passed to handlers
http://code.google.com/p/simplesamlphp/source/detail?r=2186

Modified:
 /trunk/lib/SimpleSAML/IdP/LogoutIFrame.php
 /trunk/lib/SimpleSAML/IdP/LogoutTraditional.php
 /trunk/lib/SimpleSAML/IdP.php
 /trunk/modules/core/www/idp/logout-iframe.php

=======================================
--- /trunk/lib/SimpleSAML/IdP/LogoutIFrame.php  Wed Jan 27 01:26:23 2010
+++ /trunk/lib/SimpleSAML/IdP/LogoutIFrame.php  Wed Feb 17 11:13:41 2010
@@ -24,7 +24,8 @@
                }

                foreach ($associations as $id => &$association) {
-                       $association['core:Logout-IFrame:Name'] = 
$this->idp->getSPName($id);
+                       $idp = SimpleSAML_IdP::getByState($association);
+                       $association['core:Logout-IFrame:Name'] = 
$idp->getSPName($id);
                        $association['core:Logout-IFrame:State'] = 'onhold';
                }
                $state['core:Logout-IFrame:Associations'] = $associations;
=======================================
--- /trunk/lib/SimpleSAML/IdP/LogoutTraditional.php     Wed Jan 27 01:26:23 2010
+++ /trunk/lib/SimpleSAML/IdP/LogoutTraditional.php     Wed Feb 17 11:13:41 2010
@@ -28,7 +28,8 @@
                SimpleSAML_Logger::info('Logging out of ' . var_export($id, 
TRUE) . '.');

                try {
- $url = call_user_func(array($association['Handler'], 'getLogoutURL'), $this->idp, $association, $relayState);
+                       $idp = SimpleSAML_IdP::getByState($association);
+ $url = call_user_func(array($association['Handler'], 'getLogoutURL'), $idp, $association, $relayState);
                        SimpleSAML_Utilities::redirect($url);
                } catch (Exception $e) {
SimpleSAML_Logger::warning('Unable to initialize logout to ' . var_export($id, TRUE) . '.');
=======================================
--- /trunk/lib/SimpleSAML/IdP.php       Mon Feb 15 11:18:18 2010
+++ /trunk/lib/SimpleSAML/IdP.php       Wed Feb 17 11:13:41 2010
@@ -145,20 +145,24 @@
        public function getSPName($assocId) {
                assert('is_string($assocId)');

-               if (substr($assocId, 0, 5) !== 'saml:') {
-                       return NULL;
-               }
-
-               $spEntityId = substr($assocId, 5);
+               $prefix = substr($assocId, 0, 4);
+               $spEntityId = substr($assocId, strlen($prefix) + 1);
$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
-               try {
- $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'saml20-sp-remote');
-               } catch (Exception $e) {
+
+               if ($prefix === 'saml') {
                        try {
- $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'shib13-sp-remote'); + $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'saml20-sp-remote');
                        } catch (Exception $e) {
-                               return NULL;
-                       }
+                               try {
+ $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'shib13-sp-remote');
+                               } catch (Exception $e) {
+                                       return NULL;
+                               }
+                       }
+               } else if ($prefix === 'adfs') {
+ $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'adfs-sp-remote');
+               } else {
+                       return NULL;
                }

                if ($spMetadata->hasValue('name')) {
@@ -180,6 +184,8 @@
                assert('isset($association["id"])');
                assert('isset($association["Handler"])');

+               $association['core:IdP'] = $this->id;
+
                $session = SimpleSAML_Session::getInstance();
                $session->addAssociation($this->associationGroup, $association);
        }
@@ -431,7 +437,8 @@
        public function finishLogout(array &$state) {
                assert('isset($state["Responder"])');

-               call_user_func($state['Responder'], $this, $state);
+               $idp = SimpleSAML_IdP::getByState($state);
+               call_user_func($state['Responder'], $idp, $state);
                assert('FALSE');
        }

=======================================
--- /trunk/modules/core/www/idp/logout-iframe.php       Thu Feb 11 05:46:15 2010
+++ /trunk/modules/core/www/idp/logout-iframe.php       Wed Feb 17 11:13:41 2010
@@ -79,7 +79,8 @@
                }

                try {
- $url = call_user_func(array($sp['Handler'], 'getLogoutURL'), $idp, $sp, NULL);
+                       $assocIdP = SimpleSAML_IdP::getByState($sp);
+ $url = call_user_func(array($sp['Handler'], 'getLogoutURL'), $assocIdP, $sp, NULL);
                        $sp['core:Logout-IFrame:URL'] = $url;
                } catch (Exception $e) {
                        $sp['core:Logout-IFrame:State'] = 'failed';

--
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