Skip to content

Commit 563292e

Browse files
committed
Move all organization info to Organization* metadata options.
This patch changes the metadata parsing and generation to use OrganizationName, OrganizationDisplayName and OrganizationURL. It also updates users of 'name' to check 'OrganizationDisplayName' if 'name' is unset. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2166 44740490-163a-0410-bde0-09ae8108e29a
1 parent 85047da commit 563292e

22 files changed

Lines changed: 265 additions & 74 deletions

docs/simplesamlphp-reference-idp-hosted.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,35 @@ Common options
5353
set to `__DEFAULT__`, and that IdP will be used when no other
5454
entries in the metadata matches.
5555

56+
`OrganizationName`
57+
: The name of the organization responsible for this IdP.
58+
This name does not need to be suitable for display to end users.
59+
60+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated name:
61+
62+
'OrganizationName' => array(
63+
'en' => 'Example organization',
64+
'no' => 'Eksempel organisation',
65+
),
66+
67+
: *Note*: If you specify this option, you must also specify the `OrganizationURL` option.
68+
69+
`OrganizationDisplayName`
70+
: The name of the organization responsible for this IdP.
71+
This name must be suitable for display to end users.
72+
If this option isn't specified, `OrganizationName` will be used instead.
73+
74+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated name.
75+
76+
: *Note*: If you specify this option, you must also specify the `OrganizationName` option.
77+
78+
`OrganizationURL`
79+
: An URL the end user can access for more information about the organization.
80+
81+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated URL.
82+
83+
: *Note*: If you specify this option, you must also specify the `OrganizationName` option.
84+
5685
`privacypolicy`
5786
: This is an absolute URL for where an user can find a
5887
privacypolicy. If set, this will be shown on the consent page.

docs/simplesamlphp-reference-idp-remote.txt

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,39 @@ The following options are common between both the SAML 2.0 protocol and Shibbole
4747
`icon`
4848
: A logo which will be shown next to this IdP in the discovery service.
4949

50+
`OrganizationName`
51+
: The name of the organization responsible for this SPP.
52+
This name does not need to be suitable for display to end users.
53+
54+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated name:
55+
56+
'OrganizationName' => array(
57+
'en' => 'Example organization',
58+
'no' => 'Eksempel organisation',
59+
),
60+
61+
: *Note*: If you specify this option, you must also specify the `OrganizationURL` option.
62+
63+
`OrganizationDisplayName`
64+
: The name of the organization responsible for this IdP.
65+
This name must be suitable for display to end users.
66+
If this option isn't specified, `OrganizationName` will be used instead.
67+
68+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated name.
69+
70+
: *Note*: If you specify this option, you must also specify the `OrganizationName` option.
71+
72+
`OrganizationURL`
73+
: An URL the end user can access for more information about the organization.
74+
75+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated URL.
76+
77+
: *Note*: If you specify this option, you must also specify the `OrganizationName` option.
78+
5079
`name`
51-
: The name of this IdP. Will be used by various modules when they need to show a name of the SP to the user.</p>
80+
: The name of this IdP. Will be used by various modules when they need to show a name of the SP to the user.
81+
82+
: If this option is unset, the organization name will be used instead (if it is available).
5283

5384
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated name:
5485

docs/simplesamlphp-reference-sp-hosted.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,35 @@ Common options
5353
`idpdisco.url`
5454
: Set which IdP discovery service this SP should use. If this is unset, the IdP discovery service specified in the global option `idpdisco.url.{saml20|shib13}` in `config/config.php` will be used. If that one is also unset, the builtin default discovery service will be used.
5555

56+
`OrganizationName`
57+
: The name of the organization responsible for this SPP.
58+
This name does not need to be suitable for display to end users.
59+
60+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated name:
61+
62+
'OrganizationName' => array(
63+
'en' => 'Example organization',
64+
'no' => 'Eksempel organisation',
65+
),
66+
67+
: *Note*: If you specify this option, you must also specify the `OrganizationURL` option.
68+
69+
`OrganizationDisplayName`
70+
: The name of the organization responsible for this SPP.
71+
This name must be suitable for display to end users.
72+
If this option isn't specified, `OrganizationName` will be used instead.
73+
74+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated name.
75+
76+
: *Note*: If you specify this option, you must also specify the `OrganizationName` option.
77+
78+
`OrganizationURL`
79+
: An URL the end user can access for more information about the organization.
80+
81+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated URL.
82+
83+
: *Note*: If you specify this option, you must also specify the `OrganizationName` option.
84+
5685
`name`
5786
: The name of this SP. Will be added to the generated metadata.
5887

docs/simplesamlphp-reference-sp-remote.txt

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ and Shibboleth 1.3 protocol:
4545

4646
`name`
4747
: The name of this SP. Will be used by various modules when they need
48-
to show a name of the SP to the user.</p>
48+
to show a name of the SP to the user.
49+
50+
: If this option is unset, the organization name will be used instead (if it is available).
4951

5052
: This option can be translated into multiple languages by specifying
5153
the value as an array of language-code to translated name:
@@ -55,6 +57,35 @@ and Shibboleth 1.3 protocol:
5557
'no' => 'En tjeneste',
5658
),
5759

60+
`OrganizationName`
61+
: The name of the organization responsible for this SPP.
62+
This name does not need to be suitable for display to end users.
63+
64+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated name:
65+
66+
'OrganizationName' => array(
67+
'en' => 'Example organization',
68+
'no' => 'Eksempel organisation',
69+
),
70+
71+
: *Note*: If you specify this option, you must also specify the `OrganizationURL` option.
72+
73+
`OrganizationDisplayName`
74+
: The name of the organization responsible for this IdP.
75+
This name must be suitable for display to end users.
76+
If this option isn't specified, `OrganizationName` will be used instead.
77+
78+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated name.
79+
80+
: *Note*: If you specify this option, you must also specify the `OrganizationName` option.
81+
82+
`OrganizationURL`
83+
: An URL the end user can access for more information about the organization.
84+
85+
: This option can be translated into multiple languages by specifying the value as an array of language-code to translated URL.
86+
87+
: *Note*: If you specify this option, you must also specify the `OrganizationName` option.
88+
5889
`privacypolicy`
5990
: This is an absolute URL for where an user can find a privacypolicy
6091
for this SP. If set, this will be shown on the consent page.

lib/SimpleSAML/IdP.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,13 @@ public function getSPName($assocId) {
132132
}
133133
}
134134

135-
return $spMetadata->getLocalizedString('name', array('en' => $spEntityId));
135+
if ($spMetadata->hasValue('name')) {
136+
return $spMetadata->getLocalizedString('name');
137+
} elseif ($spMetadata->hasValue('OrganizationDisplayName')) {
138+
return $spMetadata->getLocalizedString('OrganizationDisplayName');
139+
} else {
140+
return array('en' => $spEntityId);
141+
}
136142
}
137143

138144

lib/SimpleSAML/Metadata/SAMLBuilder.php

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -173,33 +173,30 @@ public function addOrganization(array $orgName, array $orgDisplayName, array $or
173173
$this->entityDescriptor->appendChild($org);
174174
}
175175

176-
177-
public function addOrganizationInfo($metadata) {
178-
if (array_key_exists('name', $metadata)) {
179-
180-
if (is_array($metadata['name'])) {
181-
$name = $metadata['name'];
182-
} else {
183-
$name = array('en' => $metadata['name']);
184-
}
185176

177+
/**
178+
* Add organization element based on metadata array.
179+
*
180+
* @param array $metadata The metadata we should extract the organization information from.
181+
*/
182+
public function addOrganizationInfo(array $metadata) {
183+
184+
if (
185+
empty($metadata['OrganizationName']) ||
186+
empty($metadata['OrganizationDisplayName']) ||
187+
empty($metadata['OrganizationURL'])
188+
) {
189+
/* Empty or incomplete organization information. */
190+
return;
191+
}
186192

187-
if (!array_key_exists('url', $metadata)) {
188-
/*
189-
* The specification requires an OrganizationURL element, but
190-
* we haven't got an URL. Insert an empty element instead.
191-
*/
192-
$url = array('en' => '');
193-
} elseif (is_array($metadata['url'])) {
194-
$url = $metadata['url'];
195-
} else {
196-
$url = array('en' => $metadata['url']);
197-
}
193+
$orgName = SimpleSAML_Utilities::arrayize($metadata['OrganizationName'], 'en');
194+
$orgDisplayName = SimpleSAML_Utilities::arrayize($metadata['OrganizationDisplayName'], 'en');
195+
$orgURL = SimpleSAML_Utilities::arrayize($metadata['OrganizationURL'], 'en');
198196

199-
$this->addOrganization($name, $name, $url);
200-
}
197+
$this->addOrganization($orgName, $orgDisplayName, $orgURL);
201198
}
202-
199+
203200

204201
/**
205202
* Add endpoint list to metadata.

lib/SimpleSAML/Metadata/SAMLParser.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,13 @@ private function getMetadataCommon() {
444444
* Add organizational metadata
445445
*/
446446
if (!empty($this->organizationName)) {
447-
$ret['name'] = $this->organizationName;
448-
$ret['description'] = $this->organizationName;
447+
$ret['OrganizationName'] = $this->organizationName;
449448
}
450449
if (!empty($this->organizationDisplayName)) {
451-
$ret['name'] = $this->organizationDisplayName;
450+
$ret['OrganizationDisplayName'] = $this->organizationDisplayName;
452451
}
453452
if (!empty($this->organizationURL)) {
454-
$ret['url'] = $this->organizationURL;
453+
$ret['OrganizationURL'] = $this->organizationURL;
455454
}
456455

457456
return $ret;

modules/adfs/www/idp/prp.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,6 @@ function ADFS_PostResponse($url, $wresult, $wctx) {
202202
}
203203
$spmetadata = SimpleSAML_Configuration::loadFromArray($arr);
204204

205-
$sp_name = $spmetadata->getValue('name', $spentityid);
206-
207205
SimpleSAML_Logger::info('ADFS - IdP.SSOService: Sending back AuthnResponse to ' . $spentityid);
208206

209207
$attributes = $session->getAttributes();

modules/consent/templates/consentform.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,28 @@
3131

3232
if (array_key_exists('name', $this->data['srcMetadata'])) {
3333
$srcName = $this->data['srcMetadata']['name'];
34-
if (is_array($srcName)) {
35-
$srcName = $this->t($srcName);
36-
}
34+
} elseif (array_key_exists('OrganizationDisplayName', $this->data['srcMetadata'])) {
35+
$srcName = $this->data['srcMetadata']['OrganizationDisplayName'];
3736
} else {
3837
$srcName = $this->data['srcMetadata']['entityid'];
3938
}
4039

40+
if (is_array($srcName)) {
41+
$srcName = $this->t($srcName);
42+
}
43+
4144
if (array_key_exists('name', $this->data['dstMetadata'])) {
4245
$dstName = $this->data['dstMetadata']['name'];
43-
if (is_array($dstName)) {
44-
$dstName = $this->t($dstName);
45-
}
46+
} elseif (array_key_exists('OrganizationDisplayName', $this->data['dstMetadata'])) {
47+
$dstName = $this->data['dstMetadata']['OrganizationDisplayName'];
4648
} else {
4749
$dstName = $this->data['dstMetadata']['entityid'];
4850
}
4951

52+
if (is_array($dstName)) {
53+
$dstName = $this->t($dstName);
54+
}
55+
5056

5157
$attributes = $this->data['attributes'];
5258

modules/consentAdmin/www/consentAdmin.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,12 @@ function driveProcessingChain($idp_metadata, $source, $sp_metadata, $sp_entityid
220220
}
221221

222222
// Set name of SP
223-
if(empty($sp_values['name']) || !is_array($sp_values['name'])) {
224-
$sp_name = $sp_empty_name;
225-
} else {
223+
if(isset($sp_values['name']) && is_array($sp_values['name'])) {
226224
$sp_name = $sp_metadata['name'];
225+
} elseif(isset($sp_values['OrganizationDisplayName']) && is_array($sp_values['OrganizationDisplayName'])) {
226+
$sp_name = $sp_metadata['OrganizationDisplayName'];
227+
} else {
228+
$sp_name = $sp_empty_name;
227229
}
228230

229231
// Set description of SP

0 commit comments

Comments
 (0)