diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index a868d5988ba4c912f2d3fa479e82cb6f64691e0a..ba584c567f692211ac03a9d005599c281b48c69c 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -402,7 +402,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 280ca923d207149ed7b6a09c5170b8122b3d3cfd..bbcb86144a5cd614568c47091ed4a8f7807857d5 100644 --- a/lib/SimpleSAML/Metadata/SAMLParser.php +++ b/lib/SimpleSAML/Metadata/SAMLParser.php @@ -690,6 +690,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 f72df230ec97a590325a073e4e599cb0a29e8e06..415a10f250ccfbeea9120c4324d6a1b48dd37257 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 abf6473a26f5eb53d394a4fda199a7603681ac5c..a0b0318ea227ca91b375a9409cf26fc2a9915d1b 100644 --- a/modules/saml/www/sp/metadata.php +++ b/modules/saml/www/sp/metadata.php @@ -164,6 +164,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