<?php /* Load simpleSAMLphp, configuration */ $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getInstance(); /* Check if valid local session exists.. */ if ($config->getBoolean('admin.protectindexpage', false)) { SimpleSAML_Utilities::requireAdmin(); } $loginurl = SimpleSAML_Utilities::getAdminLoginURL(); $isadmin = SimpleSAML_Utilities::isAdmin(); $warnings = array(); if (!SimpleSAML_Utilities::isHTTPS()) { $warnings[] = '{core:frontpage:warnings_https}'; } if ($config->getValue('secretsalt') === 'defaultsecretsalt') { $warnings[] = '{core:frontpage:warnings_secretsalt}'; } if (extension_loaded('suhosin')) { $suhosinLength = ini_get('suhosin.get.max_value_length'); if (empty($suhosinLength) || (int) $suhosinLength < 2048) { $warnings[] = '{core:frontpage:warnings_suhosin_url_length}'; } } $links = array(); $links_welcome = array(); $links_config = array(); $links_auth = array(); $links_federation = array(); $links_config[] = array('href' => SimpleSAML_Utilities::getBaseURL() . 'example-simple/hostnames.php?dummy=1', 'text' => '{core:frontpage:link_diagnostics}'); $links_config[] = array('href' => SimpleSAML_Utilities::getBaseURL() . 'admin/phpinfo.php', 'text' => '{core:frontpage:link_phpinfo}');
$metaBuilder->addContact('technical', array('emailAddress' => $config->getString('technicalcontact_email', NULL), 'name' => $config->getString('technicalcontact_name', NULL))); $metaxml = $metaBuilder->getEntityDescriptorText(); /* Sign the metadata if enabled. */ $metaxml = SimpleSAML_Metadata_Signer::sign($metaxml, $spmeta, 'SAML 2 SP'); /* * Generate list of IdPs that you can send metadata to. */ $idplist = $metadata->getList('saml20-idp-remote'); $idpsend = array(); foreach ($idplist as $entityid => $mentry) { if (array_key_exists('send_metadata_email', $mentry)) { $idpsend[$entityid] = $mentry; } } $adminok = SimpleSAML_Utilities::isAdmin(); $adminlogin = SimpleSAML_Utilities::getAdminLoginURL(SimpleSAML_Utilities::addURLParameter(SimpleSAML_Utilities::selfURLNoQuery(), array('output' => 'xhtml'))); $sentok = FALSE; /* * Send metadata to Identity Provider, if the user filled submitted the form */ if (array_key_exists('sendtoidp', $_POST)) { if (!array_key_exists($_POST['sendtoidp'], $idpsend)) { throw new Exception('Entity ID ' . $_POST['sendtoidp'] . ' not found in metadata. Cannot send metadata to this IdP.'); } $emailadr = $idpsend[$_POST['sendtoidp']]['send_metadata_email']; $from = $_POST['email']; $message = '<h1>simpleSAMLphp SAML 2.0 Service Provider Metadata</h1> <p>Metadata was sent to you from a simpleSAMLphp SAML 2.0 Service Provider. The service provider requests to connect to the following Identity Provider: <ul> <li><tt>' . htmlentities($_POST['sendtoidp']) . '</tt></li>