diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php
index a5885b7c116a2d9377a03160445d9dca8be35025..55e242607cc4b10be22463e99d2a65724ba42a71 100644
--- a/lib/SimpleSAML/Metadata/SAMLParser.php
+++ b/lib/SimpleSAML/Metadata/SAMLParser.php
@@ -460,6 +460,7 @@ class SimpleSAML_Metadata_SAMLParser {
 	public function getMetadata1xSP() {
 
 		$ret = $this->getMetadataCommon();
+		$ret['metadata-set'] = 'shib13-sp-remote';
 
 
 		/* Find SP information which supports one of the SAML 1.x protocols. */
@@ -528,6 +529,7 @@ class SimpleSAML_Metadata_SAMLParser {
 	public function getMetadata1xIdP() {
 
 		$ret = $this->getMetadataCommon();
+		$ret['metadata-set'] = 'shib13-idp-remote';
 
 		/* Find IdP information which supports the SAML 1.x protocol. */
 		$idp = $this->getIdPDescriptors(self::$SAML1xProtocols);
@@ -600,6 +602,7 @@ class SimpleSAML_Metadata_SAMLParser {
 	public function getMetadata20SP() {
 
 		$ret = $this->getMetadataCommon();
+		$ret['metadata-set'] = 'saml20-sp-remote';
 
 
 		/* Find SP information which supports the SAML 2.0 protocol. */
@@ -699,6 +702,7 @@ class SimpleSAML_Metadata_SAMLParser {
 	public function getMetadata20IdP() {
 
 		$ret = $this->getMetadataCommon();
+		$ret['metadata-set'] = 'saml20-idp-remote';
 
 
 		/* Find IdP information which supports the SAML 2.0 protocol. */
diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php
index 4ac4f4023750f3f2928f2146a6ae8e413f73c66f..df6d1f0b412953d9f5258367bd57c34e27c43edb 100644
--- a/modules/saml/www/sp/metadata.php
+++ b/modules/saml/www/sp/metadata.php
@@ -17,6 +17,8 @@ if (!($source instanceof sspmod_saml_Auth_Source_SP)) {
 
 $entityId = $source->getEntityId();
 $metaArray11 = array(
+	'metadata-set' => 'shib13-sp-remote',
+	'entityid' => $entityId,
 	'AssertionConsumerService' => SimpleSAML_Module::getModuleURL('saml/sp/saml1-acs.php/' . $sourceId),
 );
 
@@ -27,6 +29,8 @@ if ($spconfig->getBoolean('saml11.binding.artifact.enable', FALSE)) {
 
 
 $metaArray20 = array(
+	'metadata-set' => 'saml20-sp-remote',
+	'entityid' => $entityId,
 	'AssertionConsumerService' => SimpleSAML_Module::getModuleURL('saml/sp/saml2-acs.php/' . $sourceId),
 	'SingleLogoutService' => SimpleSAML_Module::getModuleURL('saml/sp/saml2-logout.php/' . $sourceId),
 );
diff --git a/modules/saml2/www/sp/metadata.php b/modules/saml2/www/sp/metadata.php
index b3462d63018c8f63a12201aefdcc3886306f2ec0..62bbdd936480491883e54b448b0db3d829f761d8 100644
--- a/modules/saml2/www/sp/metadata.php
+++ b/modules/saml2/www/sp/metadata.php
@@ -17,6 +17,8 @@ if (!($source instanceof sspmod_saml2_Auth_Source_SP)) {
 $entityId = $source->getEntityId();
 
 $metaArray = array(
+	'metadata-set' => 'saml20-sp-remote',
+	'entityid' => $entityId,
 	'AssertionConsumerService' => SimpleSAML_Module::getModuleURL('saml2/sp/acs.php'),
 	'SingleLogoutService' => SimpleSAML_Module::getModuleURL('saml2/sp/logout.php/' . $sourceId),
 	'NameIDFormat' => $source->getNameIDFormat(),
diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php
index 3dbf323b0a90b516302435f0c8c2045086528e24..2fb5d491d2b0d3968a7ebd6a3562ed675e6f073d 100644
--- a/www/saml2/idp/metadata.php
+++ b/www/saml2/idp/metadata.php
@@ -35,6 +35,8 @@ try {
 	$urlSLOr = $metadata->getGenerated('SingleLogoutServiceResponse', 'saml20-idp-hosted', array('logouttype' => $logouttype));
 
 	$metaArray = array(
+		'metadata-set' => 'saml20-idp-remote',
+		'entityid' => $idpentityid,
 		'SingleSignOnService' => $metadata->getGenerated('SingleSignOnService', 'saml20-idp-hosted', array()),
 		'SingleLogoutService' => $metadata->getGenerated('SingleLogoutService', 'saml20-idp-hosted', array('logouttype' => $logouttype)),
 		'SingleLogoutServiceResponse'  => $metadata->getGenerated('SingleLogoutServiceResponse', 'saml20-idp-hosted', array('logouttype' => $logouttype)),
diff --git a/www/saml2/sp/metadata.php b/www/saml2/sp/metadata.php
index 12e10e1ceb5817fc321a9b192864225d12fba1f9..ba3c13267f520685a66921ab960bacb16c994702 100644
--- a/www/saml2/sp/metadata.php
+++ b/www/saml2/sp/metadata.php
@@ -23,6 +23,8 @@ try {
 	$spentityid = isset($_GET['spentityid']) ? $_GET['spentityid'] : $metadata->getMetaDataCurrentEntityID();
 	
 	$metaArray = array(
+		'metadata-set' => 'saml20-sp-remote',
+		'entityid' => $spentityid,
 		'AssertionConsumerService' => $metadata->getGenerated('AssertionConsumerService', 'saml20-sp-hosted'),
 		'SingleLogoutService' => $metadata->getGenerated('SingleLogoutService', 'saml20-sp-hosted'),
 	);
diff --git a/www/shib13/idp/metadata.php b/www/shib13/idp/metadata.php
index 0ac1e257519851179fb6a3ee76622c81ef7d3c6a..93bc8b5f75233d4fa4cd7c9f0e7f77486ef97c35 100644
--- a/www/shib13/idp/metadata.php
+++ b/www/shib13/idp/metadata.php
@@ -29,6 +29,8 @@ try {
 	}
 
 	$metaArray = array(
+		'metadata-set' => 'shib13-idp-remote',
+		'entityid' => $idpentityid,
 		'SingleSignOnService' => $metadata->getGenerated('SingleSignOnService', 'shib13-idp-hosted'),
 		'certFingerprint' => $certFingerprint,
 	);
diff --git a/www/shib13/sp/metadata.php b/www/shib13/sp/metadata.php
index 1133b5781108065ea284f4be9ca62dbd3e2a0de9..fb8086b3189759f29f13b470447625dedbc02c07 100644
--- a/www/shib13/sp/metadata.php
+++ b/www/shib13/sp/metadata.php
@@ -24,6 +24,8 @@ try {
 	
 
 	$metaArray = array(
+		'metadata-set' => 'shib13-sp-remote',
+		'entityid' => $spentityid,
 		'AssertionConsumerService' => $metadata->getGenerated('AssertionConsumerService', 'shib13-sp-hosted'),
 	);