Skip to content
Snippets Groups Projects
Commit 73ccabf0 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Tidying frontpage code, as well as checking whether user is running ssp on...

Tidying frontpage code, as well as checking whether user is running ssp on https, and if not give a warning on the frontpage

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@258 44740490-163a-0410-bde0-09ae8108e29a
parent ee3701e3
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<articleinfo> <articleinfo>
<date>2007-10-15</date> <date>2007-10-15</date>
<pubdate>Fri Feb 1 08:44:40 2008</pubdate> <pubdate>Wed Feb 6 14:26:51 2008</pubdate>
<author> <author>
<firstname>Andreas Åkre</firstname> <firstname>Andreas Åkre</firstname>
......
...@@ -25,19 +25,19 @@ class SimpleSAML_Utilities { ...@@ -25,19 +25,19 @@ class SimpleSAML_Utilities {
return $currenthost; return $currenthost;
} }
public static function getSelfProtocol() {
$s = empty($_SERVER["HTTPS"]) ? ''
: ($_SERVER["HTTPS"] == "on") ? "s"
: "";
$protocol = self::strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
return $protocol;
}
public static function selfURLhost() { public static function selfURLhost() {
$currenthost = self::getSelfHost(); $currenthost = self::getSelfHost();
$s = empty($_SERVER["HTTPS"]) ? '' $protocol = self::getSelfProtocol();
: ($_SERVER["HTTPS"] == "on") ? "s"
: "";
$protocol = self::strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? ""
: (":".$_SERVER["SERVER_PORT"]);
$portnumber = $_SERVER["SERVER_PORT"]; $portnumber = $_SERVER["SERVER_PORT"];
$port = ':' . $portnumber; $port = ':' . $portnumber;
...@@ -51,6 +51,8 @@ class SimpleSAML_Utilities { ...@@ -51,6 +51,8 @@ class SimpleSAML_Utilities {
return $protocol."://" . $currenthost . $port; return $protocol."://" . $currenthost . $port;
} }
public static function selfURLNoQuery() { public static function selfURLNoQuery() {
......
...@@ -11,12 +11,24 @@ ...@@ -11,12 +11,24 @@
<ul> <ul>
<?php <?php
foreach ($data['links'] AS $link) { foreach ($this->data['links'] AS $link) {
echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . htmlspecialchars($link['text']) . '</a></li>'; echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . htmlspecialchars($link['text']) . '</a></li>';
} }
?> ?>
</ul> </ul>
</p> </p>
<?php
foreach($this->data['warnings'] AS $warning) {
echo '<div class="caution">' . $warning . '</div>';
}
?>
......
...@@ -2,14 +2,12 @@ ...@@ -2,14 +2,12 @@
require_once('_include.php'); require_once('_include.php');
require_once('SimpleSAML/Utilities.php'); require_once('SimpleSAML/Utilities.php');
require_once('SimpleSAML/Session.php'); require_once('SimpleSAML/Session.php');
require_once('SimpleSAML/XHTML/Template.php'); require_once('SimpleSAML/XHTML/Template.php');
require_once('SimpleSAML/Metadata/MetaDataStorageHandler.php'); require_once('SimpleSAML/Metadata/MetaDataStorageHandler.php');
/* Load simpleSAMLphp, configuration */ /* Load simpleSAMLphp, configuration */
$config = SimpleSAML_Configuration::getInstance(); $config = SimpleSAML_Configuration::getInstance();
$session = SimpleSAML_Session::getInstance(true); $session = SimpleSAML_Session::getInstance(true);
...@@ -24,32 +22,55 @@ if ($config->getValue('admin.protectindexpage', false)) { ...@@ -24,32 +22,55 @@ if ($config->getValue('admin.protectindexpage', false)) {
} }
$warnings = array();
if (SimpleSAML_Utilities::getSelfProtocol() != 'https') {
$warnings[] = '<strong>You are not using HTTPS</strong> - encrypted communication with the user. Using simpleSAMLphp will works perfectly fine on HTTP for test purposes, but if you will be using simpleSAMLphp in a production environment, you should be running it on HTTPS.';
}
$links = array(); $links = array();
$links[] = array('href' => 'admin/metadata.php', 'text' => 'Meta data overview for your installation. Diagnose your meta data files.'); $links[] = array(
'href' => 'admin/metadata.php',
'text' => 'Meta data overview for your installation. Diagnose your meta data files.');
if ($config->getValue('enable.saml20-sp') === true) if ($config->getValue('enable.saml20-sp') === true)
$links[] = array('href' => 'saml2/sp/metadata.php', 'text' => 'SAML 2.0 Service Provider Metadata (automatically generated)'); $links[] = array(
'href' => 'saml2/sp/metadata.php',
'text' => 'SAML 2.0 Service Provider Metadata (automatically generated)');
if ($config->getValue('enable.saml20-sp') === true) if ($config->getValue('enable.saml20-sp') === true)
$links[] = array('href' => 'example-simple/saml2-example.php', 'text' => 'SAML 2.0 SP example - test logging in through your IdP'); $links[] = array(
'href' => 'example-simple/saml2-example.php',
'text' => 'SAML 2.0 SP example - test logging in through your IdP');
if ($config->getValue('enable.saml20-idp') === true) if ($config->getValue('enable.saml20-idp') === true)
$links[] = array('href' => 'saml2/idp/metadata.php', 'text' => 'SAML 2.0 Identity Provider Metadata (automatically generated)'); $links[] = array(
'href' => 'saml2/idp/metadata.php',
'text' => 'SAML 2.0 Identity Provider Metadata (automatically generated)');
if ($config->getValue('enable.shib13-sp') === true) if ($config->getValue('enable.shib13-sp') === true)
$links[] = array('href' => 'example-simple/shib13-example.php', 'text' => 'Shibboleth 1.3 SP example - test logging in through your Shib IdP'); $links[] = array(
'href' => 'example-simple/shib13-example.php',
'text' => 'Shibboleth 1.3 SP example - test logging in through your Shib IdP');
if ($config->getValue('enable.openid-provider') === true) if ($config->getValue('enable.openid-provider') === true)
$links[] = array('href' => 'openid/provider/server.php', 'text' => 'OpenID Provider site - Alpha version (test code)'); $links[] = array(
'href' => 'openid/provider/server.php',
'text' => 'OpenID Provider site - Alpha version (test code)');
$links[] = array('href' => 'example-simple/hostnames.php', 'text' => 'Diagnostics on hostname, port and protocol'); $links[] = array(
'href' => 'example-simple/hostnames.php',
'text' => 'Diagnostics on hostname, port and protocol');
$t = new SimpleSAML_XHTML_Template($config, 'frontpage.php'); $t = new SimpleSAML_XHTML_Template($config, 'frontpage.php');
$t->data['header'] = 'simpleSAMLphp installation page'; $t->data['header'] = 'simpleSAMLphp installation page';
$t->data['icon'] = 'compass_l.png'; $t->data['icon'] = 'compass_l.png';
$t->data['warnings'] = $warnings;
$t->data['links'] = $links; $t->data['links'] = $links;
$t->show(); $t->show();
......
...@@ -90,4 +90,13 @@ dl dd { ...@@ -90,4 +90,13 @@ dl dd {
padding: .4em; padding: .4em;
font-family: monospace; font-family: monospace;
font-size: large; font-size: large;
}
div.caution {
background-color: #FF9;
background-image: url('icons/caution.png');
background-repeat: no-repeat;
border: thin solid #444;
padding: .2em .2em .2em 60px;
margin: 1em 0px 1em 0p;
} }
\ No newline at end of file
www/resources/icons/caution.png

2.31 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment