Skip to content

Commit 1ad2fd2

Browse files
committed
Merge branch 'biancini-master'
2 parents 1431fc4 + 2809ed7 commit 1ad2fd2

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

config-templates/authsources.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@
4747
* Please refer to the hosted SP configuration reference for more information.
4848
*/
4949
//'signature.algorithm' => 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',
50+
51+
/*
52+
// The attributes parameter must contain an array of desired attributes by the SP.
53+
// The attributes can be expresed as an array of names or as an associative array
54+
// in the form of 'friendlyName' => 'name'.
55+
// The metadata will then be created as follows:
56+
// <md:RequestedAttribute FriendlyName="friendlyName" Name="name" />
57+
'attributes' => array(
58+
'attrname' => 'urn:oid:x.x.x.x',
59+
),
60+
'attributes.required' => array (
61+
'urn:oid:x.x.x.x',
62+
),
63+
*/
5064
),
5165

5266

lib/SimpleSAML/Metadata/SAMLBuilder.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,12 @@ private function addAttributeConsumingService(SAML2_XML_md_SPSSODescriptor $spDe
370370
$attributeconsumer->ServiceDescription = $metadata->getLocalizedString('description', array());
371371

372372
$nameFormat = $metadata->getString('attributes.NameFormat', SAML2_Const::NAMEFORMAT_UNSPECIFIED);
373-
foreach ($attributes as $attribute) {
373+
foreach ($attributes as $friendlyName => $attribute) {
374374
$t = new SAML2_XML_md_RequestedAttribute();
375375
$t->Name = $attribute;
376+
if (!is_int($friendlyName)) {
377+
$t->FriendlyName = $friendlyName;
378+
}
376379
if ($nameFormat !== SAML2_Const::NAMEFORMAT_UNSPECIFIED) {
377380
$t->NameFormat = $nameFormat;
378381
}

modules/saml/www/sp/metadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
}
125125

126126
$name = $spconfig->getLocalizedString('name', NULL);
127-
$attributes = $spconfig->getArray('attributes', array());
127+
$attributes = array_values($spconfig->getArray('attributes', array()));
128128

129129
if ($name !== NULL && !empty($attributes)) {
130130
$metaArray20['name'] = $name;

0 commit comments

Comments
 (0)