$et->data['types'] = $util->getAllowedTypes(); $et->data['states'] = $janus_config->getArray('workflowstates'); $et->data['external'] = $janus_config->getArray('export.external'); $et->data['header'] = 'JANUS'; if (isset($_GET['msg'])) { $et->data['msg'] = $_GET['msg']; } $et->show(); exit; } $ssp_metadata = '// Metadata for state "' . $export_state . '"'; // Generate metadata try { $maxCache = $janus_config->getValue('maxCache', NULL); $maxDuration = $janus_config->getValue('maxDuration', NULL); $entities = $util->getEntitiesByStateType($export_state, $export_type); $xml = new DOMDocument(); $entitiesDescriptor = $xml->createElementNS('urn:oasis:names:tc:SAML:2.0:metadata', 'md:EntitiesDescriptor'); $entitiesDescriptorName = $janus_config->getString('export.entitiesDescriptorName', 'Federation'); $entitiesDescriptor->setAttribute('Name', $entitiesDescriptorName); if ($maxCache !== NULL) { $entitiesDescriptor->setAttribute('cacheDuration', 'PT' . $maxCache . 'S'); } if ($maxDuration !== NULL) { $entitiesDescriptor->setAttribute('validUntil', SimpleSAML_Utilities::generateTimestamp(time() + $maxDuration)); } $xml->appendChild($entitiesDescriptor); foreach ($entities as $entity) { $entityDescriptor = sspmod_janus_MetaExport::getXMLMetadata($entity['eid'], $entity['revisionid'], array('maxCache' => $maxCache, 'maxDuration' => $maxDuration)); $ssp_metadata = $ssp_metadata . "\n\n" . sspmod_janus_MetaExport::getFlatMetadata($entity['eid'], $entity['revisionid']); if (empty($entityDescriptor)) {
if (!$access) { header("HTTP/1.1 403 Permission not granted"); exit; } $t = new SimpleSAML_XHTML_Template($config, 'janus:metadataexport.php', 'janus:metadataexport'); $t->data['allowed_mime'] = $allowed_mime; $t->data['states'] = $janus_config->getArray('workflowstates'); $t->data['types'] = $util->getAllowedTypes(); $t->data['postprocessor'] = $janus_config->getArray('mdexport.postprocessor'); $t->show(); exit; } } // Generate metadata try { $entities = $util->getEntitiesByStateType($md_options['states'], $md_options['types']); // Create entitiesDescriptor $xml = new DOMDocument(); $entitiesDescriptor = $xml->createElementNS('urn:oasis:names:tc:SAML:2.0:metadata', 'md:EntitiesDescriptor'); $entitiesDescriptorName = $janus_config->getString('export.entitiesDescriptorName', $md_options['entitiesDescriptorName']); $entitiesDescriptor->setAttribute('Name', $entitiesDescriptorName); // Set caching options if ($md_options['maxCache'] !== NULL) { $entitiesDescriptor->setAttribute('cacheDuration', 'PT' . $md_options['maxCache'] . 'S'); } if ($md_options['maxDuration'] !== NULL) { $entitiesDescriptor->setAttribute('validUntil', SimpleSAML_Utilities::generateTimestamp(time() + $md_options['maxDuration'])); } $xml->appendChild($entitiesDescriptor); $ssp_metadata = '// Metadata for state "' . $md_options['states'] . '"'; $errors = array();
$remoteTypes = array('saml20-sp', 'shib13-sp'); } else { if ($entity->getType() == 'shib13-sp') { $remoteTypes = array('saml20-idp', 'shib13-idp'); } else { if ($entity->getType() == 'shib13-idp') { $remoteTypes = array('saml20-sp', 'shib13-sp'); } else { throw new Exception('New type'); } } } } $remoteEntities = array(); foreach ($remoteTypes as $remoteType) { $remoteEntities = array_merge($remoteEntities, $adminUtil->getEntitiesByStateType(null, $remoteType)); } if ($securityContext->isGranted('allentities')) { $userEntities = $remoteEntities; } else { $userEntities = $adminUtil->getEntitiesFromUser($user->getUid()); } $reverseBlockedEntities = $adminUtil->getReverseBlockedEntities($entity, $userEntities); // Get metadatafields $mfc = $janus_config->getArray('metadatafields.' . $entity->getType()); $mb = new sspmod_janus_MetadataFieldBuilder($mfc); $et->data['metadatafields'] = $mb->getMetadataFields(); $remote_entities = array(); $remote_entities_acl_sorted = array(); // Only parse name and description in current language foreach ($remoteEntities as $remoteEntityRow) {
$entity->setRevisionnote($_POST['revisionnote']); } // Update entity if updated if ($update) { $mcontroller->saveEntity(); $mcontroller->loadEntity(); $pm = new sspmod_janus_Postman(); $addresses[] = 'ENTITYUPDATE-' . $eid; $directlink = SimpleSAML_Module::getModuleURL('janus/editentity.php', array('eid' => $entity->getEid(), 'revisionid' => $entity->getRevisionid())); $pm->post('Entity updated - ' . $entity->getEntityid(), 'Permalink: <a href="' . $directlink . '">' . $directlink . '</a><br /><br />' . $entity->getRevisionnote() . '<br /><br />' . $note, $addresses, $user->getUid()); } SimpleSAML_Utilities::redirect(SimpleSAML_Utilities::selfURLNoQuery(), array('eid' => $eid, 'msg' => $msg)); } // Get remote entities if ($entity->getType() == 'saml20-sp') { $loaded_entities = array_merge($autil->getEntitiesByStateType(null, 'saml20-idp'), $autil->getEntitiesByStateType(null, 'shib13-idp')); } else { if ($entity->getType() == 'saml20-idp') { $loaded_entities = array_merge($autil->getEntitiesByStateType(null, 'saml20-sp'), $autil->getEntitiesByStateType(null, 'shib13-sp')); } else { if ($entity->getType() == 'shib13-sp') { $loaded_entities = array_merge($autil->getEntitiesByStateType(null, 'saml20-idp'), $autil->getEntitiesByStateType(null, 'shib13-idp')); } else { if ($entity->getType() == 'shib13-idp') { $loaded_entities = array_merge($autil->getEntitiesByStateType(null, 'saml20-sp'), $autil->getEntitiesByStateType(null, 'shib13-sp')); } } } } // Get metadatafields $mfc = $janus_config->getArray('metadatafields.' . $entity->getType());