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

Remove old admin endpoints

parent 3a80d02b
No related branches found
No related tags found
No related merge requests found
<?php
require_once('../_include.php');
// Load SimpleSAMLphp configuration
$config = \SimpleSAML\Configuration::getInstance();
$session = \SimpleSAML\Session::getSessionFromRequest();
// Check if valid local session exists..
\SimpleSAML\Utils\Auth::requireAdmin();
$attributes = [];
$attributes['HTTP_HOST'] = [$_SERVER['HTTP_HOST']];
$attributes['HTTPS'] = isset($_SERVER['HTTPS']) ? [$_SERVER['HTTPS']] : [];
$attributes['SERVER_PROTOCOL'] = [$_SERVER['SERVER_PROTOCOL']];
$attributes['SERVER_PORT'] = [$_SERVER['SERVER_PORT']];
$attributes['getBaseURL()'] = [\SimpleSAML\Utils\HTTP::getBaseURL()];
$attributes['getSelfHost()'] = [\SimpleSAML\Utils\HTTP::getSelfHost()];
$attributes['getSelfHostWithNonStandardPort()'] = [\SimpleSAML\Utils\HTTP::getSelfHostWithNonStandardPort()];
$attributes['selfURLhost()'] = [\SimpleSAML\Utils\HTTP::getSelfURLHost()];
$attributes['selfURLNoQuery()'] = [\SimpleSAML\Utils\HTTP::getSelfURLNoQuery()];
$attributes['getSelfHostWithPath()'] = [\SimpleSAML\Utils\HTTP::getSelfHostWithPath()];
$attributes['getFirstPathElement()'] = [\SimpleSAML\Utils\HTTP::getFirstPathElement()];
$attributes['selfURL()'] = [\SimpleSAML\Utils\HTTP::getSelfURL()];
$template = new \SimpleSAML\XHTML\Template($config, 'hostnames.php');
$template->data['remaining'] = $session->getAuthData('admin', 'Expire') - time();
$template->data['attributes'] = $attributes;
$template->data['valid'] = 'na';
$template->data['logout'] = null;
$template->show();
<?php
require_once('../_include.php');
\SimpleSAML\Utils\HTTP::redirectTrustedURL(\SimpleSAML\Module::getModuleURL('admin/'));
// Load SimpleSAMLphp configuration
$config = \SimpleSAML\Configuration::getInstance();
$session = \SimpleSAML\Session::getSessionFromRequest();
// Check if valid local session exists..
\SimpleSAML\Utils\Auth::requireAdmin();
$adminpages = [
'hostnames.php' => 'Diagnostics on hostname, port and protocol',
'phpinfo.php' => 'PHP info',
'../module.php/sanitycheck/index.php' => 'Sanity check of your SimpleSAMLphp setup',
'sandbox.php' => 'Sandbox for testing changes to layout and css',
];
$logouturl = \SimpleSAML\Utils\Auth::getAdminLogoutURL();
$template = new \SimpleSAML\XHTML\Template($config, 'index.php');
$template->data['pagetitle'] = 'Admin';
$template->data['adminpages'] = $adminpages;
$template->data['remaining'] = $session->getAuthData('admin', 'Expire') - time();
$template->data['valid'] = 'na';
$template->data['logouturl'] = $logouturl;
$template->show();
<?php
require_once('../_include.php');
use Symfony\Component\VarExporter\VarExporter;
// make sure that the user has admin access rights
\SimpleSAML\Utils\Auth::requireAdmin();
$config = \SimpleSAML\Configuration::getInstance();
if (!empty($_FILES['xmlfile']['tmp_name'])) {
$xmldata = trim(file_get_contents($_FILES['xmlfile']['tmp_name']));
} elseif (array_key_exists('xmldata', $_POST)) {
$xmldata = trim($_POST['xmldata']);
}
if (!empty($xmldata)) {
\SimpleSAML\Utils\XML::checkSAMLMessage($xmldata, 'saml-meta');
$entities = \SimpleSAML\Metadata\SAMLParser::parseDescriptorsString($xmldata);
// get all metadata for the entities
foreach ($entities as &$entity) {
$entity = [
'saml20-sp-remote' => $entity->getMetadata20SP(),
'saml20-idp-remote' => $entity->getMetadata20IdP(),
];
}
// transpose from $entities[entityid][type] to $output[type][entityid]
$output = \SimpleSAML\Utils\Arrays::transpose($entities);
// merge all metadata of each type to a single string which should be added to the corresponding file
foreach ($output as $type => &$entities) {
$text = '';
foreach ($entities as $entityId => $entityMetadata) {
if ($entityMetadata === null) {
continue;
}
// remove the entityDescriptor element because it is unused, and only makes the output harder to read
unset($entityMetadata['entityDescriptor']);
$text .= '$metadata[' . var_export($entityId, true) . '] = ' .
VarExporter::export($entityMetadata) . ";\n";
}
$entities = $text;
}
} else {
$xmldata = '';
$output = [];
}
$template = new \SimpleSAML\XHTML\Template($config, 'metadata-converter.php', 'admin');
$template->data['clipboard.js'] = true;
$template->data['xmldata'] = $xmldata;
$template->data['output'] = $output;
$template->show();
<?php
require_once('../_include.php');
// Make sure that the user has admin access rights
\SimpleSAML\Utils\Auth::requireAdmin();
phpinfo();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment