diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index 90451b7130eaabd1ac9fb2a5eebb259c755085bf..1d5e7d32ad0e1c94900f9bdfb815b001061dacdf 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -403,7 +403,11 @@ class SimpleSAML_Metadata_SAMLBuilder */ $attributeconsumer = new \SAML2\XML\md\AttributeConsumingService(); - $attributeconsumer->index = 0; + $attributeconsumer->index = $metadata->getInteger('attributes.index', 0); + + if ($metadata->hasValue('attributes.isDefault')) { + $attributeconsumer->isDefault = $metadata->getBoolean('attributes.isDefault', false); + } $attributeconsumer->ServiceName = $name; $attributeconsumer->ServiceDescription = $metadata->getLocalizedString('description', array()); diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php index bd8886e6808a84d4178c4bbead984d2ed170ca3d..9f55a243fa0bf8f54ecdd2652a6cfcbbb4a8358c 100644 --- a/lib/SimpleSAML/Metadata/SAMLParser.php +++ b/lib/SimpleSAML/Metadata/SAMLParser.php @@ -708,6 +708,12 @@ class SimpleSAML_Metadata_SAMLParser if (array_key_exists('attributes.NameFormat', $spd)) { $ret['attributes.NameFormat'] = $spd['attributes.NameFormat']; } + if (array_key_exists('attributes.index', $spd)) { + $ret['attributes.index'] = $spd['attributes.index']; + } + if (array_key_exists('attributes.isDefault', $spd)) { + $ret['attributes.isDefault'] = $spd['attributes.isDefault']; + } // add name & description if (array_key_exists('name', $spd)) { diff --git a/modules/saml/docs/sp.md b/modules/saml/docs/sp.md index 31def6f691f750721a1b46ec9a3d18763dd20a69..d3ca6791d2cc356cc8f4a74f3ed2c9680bd3fc2b 100644 --- a/modules/saml/docs/sp.md +++ b/modules/saml/docs/sp.md @@ -125,6 +125,12 @@ Options `attributes.NameFormat` : The `NameFormat` for the requested attributes. +`attributes.index` +: The `index` attribute that is set in the md:AttributeConsumingService element. Integer value that defaults to `0`. + +`attributes.isDefault` +: If present, sets the `isDefault` attribute in the md:AttributeConsumingService element. Boolean value that defaults to `false`. + `attributes.required` : If you have attributes added you can here specify which should be marked as required. : The attributes should still be present in `attributes`. diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php index 9aa17835e25aaa0361f5275b5f17079af62d7d7d..2bedb7756c69bec35ff81092e8c48c44c7a49846 100644 --- a/modules/saml/www/sp/metadata.php +++ b/modules/saml/www/sp/metadata.php @@ -148,6 +148,14 @@ if ($name !== null && !empty($attributes)) { if ($nameFormat !== null) { $metaArray20['attributes.NameFormat'] = $nameFormat; } + + if ($spconfig->hasValue('attributes.index')) { + $metaArray20['attributes.index'] = $spconfig->getInteger('attributes.index', 0); + } + + if ($spconfig->hasValue('attributes.isDefault')) { + $metaArray20['attributes.isDefault'] = $spconfig->getBoolean('attributes.isDefault', false); + } } // add organization info