Revision: 1844
Author: olavmrk
Date: Mon Oct 12 07:00:17 2009
Log: SAMLBuilder: Handle multiple ACS endpoints.
http://code.google.com/p/simplesamlphp/source/detail?r=1844

Modified:
  /trunk/lib/SimpleSAML/Metadata/SAMLBuilder.php

=======================================
--- /trunk/lib/SimpleSAML/Metadata/SAMLBuilder.php      Thu Oct  8 05:10:33 2009
+++ /trunk/lib/SimpleSAML/Metadata/SAMLBuilder.php      Mon Oct 12 07:00:17 2009
@@ -263,22 +263,27 @@
                        $e->appendChild($t);
                }

+               $acsIndex = 0;
                if (array_key_exists('AssertionConsumerService', $metadata)) {
-                       $index = 0;
-                       if 
(array_key_exists('AssertionConsumerService.artifact', $metadata)) {
+                       foreach  
(SimpleSAML_Utilities::arrayize($metadata['AssertionConsumerService']) as  
$acs) {
                                $t = 
$this->createElement('AssertionConsumerService');
-                               $t->setAttribute('index', (string)$index);
+                               $t->setAttribute('index', (string)$acsIndex);
+                                
$t->setAttribute('Binding', 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST');
+                               $t->setAttribute('Location', $acs);
+                               $e->appendChild($t);
+                               $acsIndex += 1;
+                       }
+               }
+               if (array_key_exists('AssertionConsumerService.artifact', 
$metadata)) {
+                       foreach  
(SimpleSAML_Utilities::arrayize($metadata['AssertionConsumerService.artifact']) 
 
as $acs) {
+                               $t = 
$this->createElement('AssertionConsumerService');
+                               $t->setAttribute('index', (string)$acsIndex);
                                 
$t->setAttribute('Binding', 
'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact');
-                               $t->setAttribute('Location',  
$metadata['AssertionConsumerService.artifact']);
+                               $t->setAttribute('Location', $acs);
                                $e->appendChild($t);
-                               $index++;
+                               $acsIndex += 1;
                        }

-                       $t = $this->createElement('AssertionConsumerService');
-                       $t->setAttribute('index', (string)$index);
-                        
$t->setAttribute('Binding', 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST');
-                       $t->setAttribute('Location', 
$metadata['AssertionConsumerService']);
-                       $e->appendChild($t);
                }


@@ -425,23 +430,27 @@
                        $e->appendChild($t);
                }

+               $acsIndex = 0;
                if (array_key_exists('AssertionConsumerService', $metadata)) {
-
-                       $index = 0;
-                       if 
(array_key_exists('AssertionConsumerService.artifact', $metadata)) {
+                       foreach  
(SimpleSAML_Utilities::arrayize($metadata['AssertionConsumerService']) as  
$acs) {
                                $t = 
$this->createElement('AssertionConsumerService');
-                               $t->setAttribute('index', (string)$index);
+                               $t->setAttribute('index', (string)$acsIndex);
+                                
$t->setAttribute('Binding', 
'urn:oasis:names:tc:SAML:1.0:profiles:browser-post');
+                               $t->setAttribute('Location', $acs);
+                               $e->appendChild($t);
+                               $acsIndex += 1;
+                       }
+               }
+               if (array_key_exists('AssertionConsumerService.artifact', 
$metadata)) {
+                       foreach  
(SimpleSAML_Utilities::arrayize($metadata['AssertionConsumerService.artifact']) 
 
as $acs) {
+                               $t = 
$this->createElement('AssertionConsumerService');
+                               $t->setAttribute('index', (string)$acsIndex);
                                 
$t->setAttribute('Binding', 'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01');
-                               $t->setAttribute('Location',  
$metadata['AssertionConsumerService.artifact']);
+                               $t->setAttribute('Location', $acs);
                                $e->appendChild($t);
-                               $index++;
-                       }
-
-                       $t = $this->createElement('AssertionConsumerService');
-                       $t->setAttribute('index', (string)$index);
-                        
$t->setAttribute('Binding', 
'urn:oasis:names:tc:SAML:1.0:profiles:browser-post');
-                       $t->setAttribute('Location', 
$metadata['AssertionConsumerService']);
-                       $e->appendChild($t);
+                               $acsIndex += 1;
+                       }
+
                }

                $this->entityDescriptor->appendChild($e);

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