From 7cc6b92f01cd5f66886ca150e7eb124a893f8fe0 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Mon, 8 Feb 2010 09:13:00 +0000 Subject: [PATCH] saml/sp: Add organization information to metadata. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2162 44740490-163a-0410-bde0-09ae8108e29a --- modules/saml/docs/sp.txt | 29 +++++++++++++++++++++++++++++ modules/saml/www/sp/metadata.php | 18 ++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/modules/saml/docs/sp.txt b/modules/saml/docs/sp.txt index 6390e1a47..3d1f382b7 100644 --- a/modules/saml/docs/sp.txt +++ b/modules/saml/docs/sp.txt @@ -169,6 +169,35 @@ Options : *Note 2*: SAML 2 specific. +`OrganizationName` +: The name of the organization responsible for this SP. + This name does not need to be suitable for display to end users. + +: This option can be translated into multiple languages by specifying the value as an array of language-code to translated name: + + 'OrganizationName' => array( + 'en' => 'Example organization', + 'no' => 'Eksempel organisation', + ), + +: *Note*: If you specify this option, you must also specify the `OrganizationURL` option. + +`OrganizationDisplayName` +: The name of the organization responsible for this SP. + This name must be suitable for display to end users. + If this option isn't specified, `OrganizationName` will be used instead. + +: This option can be translated into multiple languages by specifying the value as an array of language-code to translated name. + +: *Note*: If you specify this option, you must also specify the `OrganizationName` option. + +`OrganizationURL` +: An URL the end user can access for more information about the organization. + +: This option can be translated into multiple languages by specifying the value as an array of language-code to translated URL. + +: *Note*: If you specify this option, you must also specify the `OrganizationName` option. + `privatekey` : File name of private key to be used for signing messages and decrypting messages from the IdP. This option is only required if you use encrypted assertions or if you enable signing of messages. diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php index c64da9269..f228a9bb3 100644 --- a/modules/saml/www/sp/metadata.php +++ b/modules/saml/www/sp/metadata.php @@ -77,6 +77,24 @@ $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($entityId); $metaBuilder->addMetadataSP11($metaArray11); $metaBuilder->addMetadataSP20($metaArray20); + +$orgName = $spconfig->getLocalizedString('OrganizationName', NULL); +if ($orgName !== NULL) { + + $orgDisplayName = $spconfig->getLocalizedString('OrganizationDisplayName', NULL); + if ($orgDisplayName === NULL) { + $orgDisplayName = $orgName; + } + + $orgURL = $spconfig->getLocalizedString('OrganizationURL', NULL); + if ($orgURL === NULL) { + throw new SimpleSAML_Error_Exception('If OrganizationName is set, OrganizationURL must also be set.'); + } + + + $metaBuilder->addOrganization($orgName, $orgDisplayName, $orgURL); +} + $config = SimpleSAML_Configuration::getInstance(); $metaBuilder->addContact('technical', array( 'emailAddress' => $config->getString('technicalcontact_email', NULL), -- GitLab