$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)) {
         $t = new SimpleSAML_XHTML_Template($config, 'janus:error.php', 'janus:error');
         $t->data['header'] = 'JANUS';
         $t->data['title'] = 'error_required_metadata_missing_header';
         $t->data['error'] = 'error_required_metadata_missing_entity';
         $t->data['error_data'] = array('%ENTITY%' => $entity['entityid']);
         $t->data['extra_data'] = implode("\n", sspmod_janus_MetaExport::getError());
         $t->show();
         exit(0);
     }
     $entitiesDescriptor->appendChild($xml->importNode($entityDescriptor, TRUE));
 }
 /* Sign the metadata if enabled. */
 if ($janus_config->getBoolean('sign.enable', FALSE)) {
     $signer = new SimpleSAML_XML_Signer(array('privatekey' => $janus_config->getString('sign.privatekey'), 'privatekey_pass' => $janus_config->getString('sign.privatekey_pass', NULL), 'certificate' => $janus_config->getString('sign.certificate'), 'id' => 'ID'));
     $signer->sign($entitiesDescriptor, $entitiesDescriptor, $entitiesDescriptor->firstChild);
 }
 if (isset($export_external)) {
     $externalconfig = $janus_config->getArray('export.external');
     if (array_key_exists($export_external, $externalconfig)) {
         $externalconfig = $externalconfig[$export_external];
         try {
Beispiel #2
0
if (isset($_GET['revisionid'])) {
    $revisionid = $_GET['revisionid'];
} else {
    throw new SimpleSAML_Error_Exception('Revisionid must be set');
}
$md_options = $janus_config->getValue('mdexport.default_options');
$metaxml = sspmod_janus_MetaExport::getReadableXMLMetadata($eid, $revisionid, array('maxCache' => $md_options['maxCache'], 'maxDuration' => $md_options['maxDuration']));
$metaflat = sspmod_janus_MetaExport::getFlatMetadata($eid, $revisionid);
$metaarray = sspmod_janus_MetaExport::getPHPArrayMetadata($eid, $revisionid);
// Error generating som of the metadata
if (empty($metaflat) || empty($metaxml)) {
    $t = new SimpleSAML_XHTML_Template($config, 'janus:error.php', 'janus:error');
    $t->data['header'] = 'JANUS';
    $t->data['title'] = 'error_required_metadata_missing_header';
    $t->data['error'] = 'error_required_metadata_missing';
    $t->data['extra_data'] = '<ul><li>' . implode("</li>\n<li>", sspmod_janus_MetaExport::getError()) . '</li></ul>';
    $t->show();
    exit(0);
} elseif (array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml') {
    $t = new SimpleSAML_XHTML_Template($config, 'janus:metadata.php', 'janus:metadata');
    $t->data['header'] = 'Metadata export';
    $t->data['metaurl'] = SimpleSAML_Utilities::selfURLNoQuery();
    $t->data['metadata'] = htmlentities($metaxml);
    $t->data['metadataflat'] = htmlentities($metaflat, ENT_COMPAT, 'UTF-8');
    $t->data['metadatajson'] = json_encode($metaarray);
    $t->data['revision'] = $revisionid;
    $t->data['eid'] = $eid;
    $t->show();
} elseif (array_key_exists('output', $_GET) && $_GET['output'] == 'json') {
    header('Content-Type: application/json');
    echo json_encode($metaarray);
Beispiel #3
0
     // Ignore excluded entities
     if (in_array($entity['entityid'], $md_options['exclude'])) {
         continue;
     }
     // Get metadata for entity
     // In XML
     $entityDescriptor = sspmod_janus_MetaExport::getXMLMetadata($entity['eid'], $entity['revisionid'], array('maxCache' => $md_options['maxCache'], 'maxDuration' => $md_options['maxDuration']));
     // In flat file
     $ssp_metadata = $ssp_metadata . "\n\n" . sspmod_janus_MetaExport::getFlatMetadata($entity['eid'], $entity['revisionid']);
     // Error handling
     if (empty($entityDescriptor) || !$entityDescriptor) {
         // Ignore errors
         if ($md_options['ignore_errors']) {
             continue;
         } else {
             $errors[$entity['entityid']] = sspmod_janus_MetaExport::getError();
         }
     } else {
         // Append metadata to entitiesDescriptor
         $entitiesDescriptor->appendChild($xml->importNode($entityDescriptor, TRUE));
     }
 }
 // Display errors if any and ignore_errors is not set
 if (count($errors) > 0 && !$md_options['ignore_errors']) {
     $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->data['error_type'] = 'error_type_required_metadata';
     $t->data['errors'] = "";