diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php
index 80de944f9b134a13b8a0d3f957ff0e0e7dd445cb..2a2f447f25f3435367c5a6184c385aa8417f9a45 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 47c8aaa99c4882a1d8a5cb306f0b179db8719a58..e6ef139b9c9267fdef088cead23afdc9f423ed5d 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);