From 372062ecb494fd8d2534f101873fe87e2e448f94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Tue, 1 Sep 2009 11:40:32 +0000
Subject: [PATCH] SAML auth source exposes artifact endpoints... (support
 beeing added these days...)

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1736 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Metadata/SAMLBuilder.php | 25 +++++++++++++++++++++++--
 modules/saml/www/sp/metadata.php        | 19 +++++++++++++++++--
 2 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php
index 80de944f9..2a2f447f2 100644
--- a/lib/SimpleSAML/Metadata/SAMLBuilder.php
+++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php
@@ -264,8 +264,18 @@ class SimpleSAML_Metadata_SAMLBuilder {
 		}
 
 		if (array_key_exists('AssertionConsumerService', $metadata)) {
+			$index = 0;
+			if (array_key_exists('AssertionConsumerService.artifact', $metadata)) {
+				$t = $this->createElement('AssertionConsumerService');
+				$t->setAttribute('index', (string)$index);
+				$t->setAttribute('Binding', 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact');
+				$t->setAttribute('Location', $metadata['AssertionConsumerService.artifact']);
+				$e->appendChild($t);
+				$index++;
+			}
+
 			$t = $this->createElement('AssertionConsumerService');
-			$t->setAttribute('index', '0');
+			$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);
@@ -438,8 +448,19 @@ class SimpleSAML_Metadata_SAMLBuilder {
 		}
 
 		if (array_key_exists('AssertionConsumerService', $metadata)) {
+
+			$index = 0;
+			if (array_key_exists('AssertionConsumerService.artifact', $metadata)) {
+				$t = $this->createElement('AssertionConsumerService');
+				$t->setAttribute('index', (string)$index);
+				$t->setAttribute('Binding', 'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01');
+				$t->setAttribute('Location', $metadata['AssertionConsumerService.artifact']);
+				$e->appendChild($t);
+				$index++;
+			}
+			
 			$t = $this->createElement('AssertionConsumerService');
-			$t->setAttribute('index', '0');
+			$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);
diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php
index 47c8aaa99..e6ef139b9 100644
--- a/modules/saml/www/sp/metadata.php
+++ b/modules/saml/www/sp/metadata.php
@@ -19,12 +19,27 @@ $entityId = $source->getEntityId();
 
 $metaArray11 = array(
 	'AssertionConsumerService' => SimpleSAML_Module::getModuleURL('saml/sp/saml1-acs.php'),
-	);
+);
+
+$spconfig = $source->getMetadata();
+
+if ($spconfig->getBoolean('saml11.binding.artifact.enable', FALSE)) {
+	$metaArray11['AssertionConsumerService.artifact'] = SimpleSAML_Module::getModuleURL('saml/sp/saml1-acs.php/artifact');
+}
+
+
 
 $metaArray20 = array(
 	'AssertionConsumerService' => SimpleSAML_Module::getModuleURL('saml/sp/saml2-acs.php'),
 	'SingleLogoutService' => SimpleSAML_Module::getModuleURL('saml/sp/saml2-logout.php/' . $sourceId),
-	);
+);
+	
+if ($spconfig->getBoolean('saml20.binding.artifact.enable', FALSE)) {
+	$metaArray20['AssertionConsumerService.artifact'] = SimpleSAML_Module::getModuleURL('saml/sp/saml2-acs.php/artifact');
+}
+
+
+
 
 $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($entityId);
 $metaBuilder->addMetadataSP11($metaArray11);
-- 
GitLab