Skip to content
Snippets Groups Projects
Commit bda996f9 authored by Thomas Vanhaniemi's avatar Thomas Vanhaniemi
Browse files

Added configuration support for index and isDefault on the generated...

Added configuration support for index and isDefault on the generated md:AttributeConsumingService element

Added two metadata configuration options attributes.index and attributes.isDefault to the Service Provider section that outputs to the md:AttributeConsumingService element.
attributes.index overrides the index attribute value with another integer value specified.
attributes.isDefault adds the isDefault attribute with the given boolean value, if the configuration option is specified.
parent d68d4087
No related branches found
No related tags found
No related merge requests found
......@@ -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());
......
......@@ -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)) {
......
......@@ -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`.
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment