Skip to content
Snippets Groups Projects
Commit 4efe184a authored by Jaime Perez's avatar Jaime Perez
Browse files

Migrate hosted SP metadata to use the new getContact() helper function....

Migrate hosted SP metadata to use the new getContact() helper function. Include also the contact information in SSP generated configuration.
parent 612d1fcc
Branches
Tags
No related merge requests found
...@@ -158,28 +158,21 @@ if ($orgName !== NULL) { ...@@ -158,28 +158,21 @@ if ($orgName !== NULL) {
} }
} }
// add technical contact if ($spconfig->hasValue('contacts')) {
$email = $config->getString('technicalcontact_email', 'na@example.org'); $contacts = $spconfig->getArray('contacts');
if ( $email != 'na@example.org') { foreach ($contacts as $contact) {
$metaArray20['contacts'][] = SimpleSAML_Utils_Config_Metadata::getContact($contact);
$contact = array('emailAddress' => $email);
$name = $config->getString('technicalcontact_name', NULL);
if ($name === NULL) {
/* Nothing to do here... */
} elseif (preg_match('@^(.*?)\s*,\s*(.*)$@D', $name, $matches)) {
$contact['surName'] = $matches[1];
$contact['givenName'] = $matches[2];
} elseif (preg_match('@^(.*?)\s+(.*)$@D', $name, $matches)) {
$contact['givenName'] = $matches[1];
$contact['surName'] = $matches[2];
} else {
$contact['givenName'] = $name;
} }
} }
// add additional contacts // add technical contact
$contacts = $spconfig->getArray('contacts', array()); $email = $config->getString('technicalcontact_email', 'na@example.org', FALSE);
if ($email && $email !== 'na@example.org') {
$techcontact['emailAddress'] = $email;
$techcontact['name'] = $config->getString('technicalcontact_name', NULL);
$techcontact['contactType'] = 'technical';
$metaArray20['contacts'][] = SimpleSAML_Utils_Config_Metadata::getContact($techcontact);
}
// add certificate // add certificate
if (count($keys) === 1) { if (count($keys) === 1) {
...@@ -206,10 +199,6 @@ $metaArray20['entityid'] = $entityId; ...@@ -206,10 +199,6 @@ $metaArray20['entityid'] = $entityId;
$metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($entityId); $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($entityId);
$metaBuilder->addMetadataSP20($metaArray20, $supported_protocols); $metaBuilder->addMetadataSP20($metaArray20, $supported_protocols);
$metaBuilder->addOrganizationInfo($metaArray20); $metaBuilder->addOrganizationInfo($metaArray20);
if ( !empty($contact) ) $metaBuilder->addContact('technical', $contact);
foreach ($contacts as $c) {
$metaBuilder->addContact($c['contactType'], $c);
}
$xml = $metaBuilder->getEntityDescriptorText(); $xml = $metaBuilder->getEntityDescriptorText();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment