From 73ccabf060947b66ada0e1ee02261567bba0ff70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Thu, 7 Feb 2008 09:29:33 +0000 Subject: [PATCH] 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 --- docs/source/simplesamlphp-sp.xml | 2 +- lib/SimpleSAML/Utilities.php | 18 +++++++------ templates/default/en/frontpage.php | 14 ++++++++++- www/index.php | 39 ++++++++++++++++++++++------- www/resources/default.css | 9 +++++++ www/resources/icons/caution.png | Bin 0 -> 2369 bytes 6 files changed, 63 insertions(+), 19 deletions(-) create mode 100755 www/resources/icons/caution.png diff --git a/docs/source/simplesamlphp-sp.xml b/docs/source/simplesamlphp-sp.xml index 35a05fa86..ad82586a9 100644 --- a/docs/source/simplesamlphp-sp.xml +++ b/docs/source/simplesamlphp-sp.xml @@ -7,7 +7,7 @@ <articleinfo> <date>2007-10-15</date> - <pubdate>Fri Feb 1 08:44:40 2008</pubdate> + <pubdate>Wed Feb 6 14:26:51 2008</pubdate> <author> <firstname>Andreas Åkre</firstname> diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 822a97ddd..068428bb9 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -25,19 +25,19 @@ class SimpleSAML_Utilities { 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() { $currenthost = self::getSelfHost(); - $s = empty($_SERVER["HTTPS"]) ? '' - : ($_SERVER["HTTPS"] == "on") ? "s" - : ""; - $protocol = self::strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; - - $port = ($_SERVER["SERVER_PORT"] == "80") ? "" - : (":".$_SERVER["SERVER_PORT"]); - + $protocol = self::getSelfProtocol(); $portnumber = $_SERVER["SERVER_PORT"]; $port = ':' . $portnumber; @@ -51,6 +51,8 @@ class SimpleSAML_Utilities { return $protocol."://" . $currenthost . $port; } + + public static function selfURLNoQuery() { diff --git a/templates/default/en/frontpage.php b/templates/default/en/frontpage.php index a4279a02e..bc2ff455f 100644 --- a/templates/default/en/frontpage.php +++ b/templates/default/en/frontpage.php @@ -11,12 +11,24 @@ <ul> <?php - foreach ($data['links'] AS $link) { + foreach ($this->data['links'] AS $link) { echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . htmlspecialchars($link['text']) . '</a></li>'; } ?> </ul> </p> + <?php + + foreach($this->data['warnings'] AS $warning) { + + + echo '<div class="caution">' . $warning . '</div>'; + + + + } + + ?> diff --git a/www/index.php b/www/index.php index 449e72ec2..9f756764e 100644 --- a/www/index.php +++ b/www/index.php @@ -2,14 +2,12 @@ require_once('_include.php'); - require_once('SimpleSAML/Utilities.php'); require_once('SimpleSAML/Session.php'); require_once('SimpleSAML/XHTML/Template.php'); require_once('SimpleSAML/Metadata/MetaDataStorageHandler.php'); - /* Load simpleSAMLphp, configuration */ $config = SimpleSAML_Configuration::getInstance(); $session = SimpleSAML_Session::getInstance(true); @@ -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('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) - $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) - $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) - $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) - $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) - $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->data['header'] = 'simpleSAMLphp installation page'; $t->data['icon'] = 'compass_l.png'; +$t->data['warnings'] = $warnings; $t->data['links'] = $links; $t->show(); diff --git a/www/resources/default.css b/www/resources/default.css index f6830d909..e82beee15 100644 --- a/www/resources/default.css +++ b/www/resources/default.css @@ -90,4 +90,13 @@ dl dd { padding: .4em; font-family: monospace; 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 diff --git a/www/resources/icons/caution.png b/www/resources/icons/caution.png new file mode 100755 index 0000000000000000000000000000000000000000..e3897db8771158c562faec8dfa675633ba677007 GIT binary patch literal 2369 zcmeAS@N?(olHy`uVBq!ia0y~yU@!n-4mJh`hH$2z?F<YIY)RhkE)4%caKYZ?lNlHo zI14-?iy0WWg+Q3`(%rg03=9nHC7!;n?3X!&_+-Sol&^kbU|_H-ag8W(&d<$F%`0JW zE=o--Nlj5G&n(GM2+2rQaQE~L;NsFq)>JSuFfdl|O3W@zQc%yz%*{<qR#ylvNzKel zEmAjrAHl%D(c<ai7*cWT?ab<ekgKxC?aR$My-&2cFJL^R{b@?nf&({{I+&VTjWPs- zC8E+_Ik?U(w3@4x-0qbAtH49{UcXV4s{@O*uYA(&A2YHRGIF^Iwg|MDPfBn)l(u>I z$#;97f9bD&_wMFtwVNJWEDq1LEdD-k@AEtFzkmPzukLyI`^M<wYad_xIMuF4KjWUA z!@jaw))l{22}tmXFcxpwCwyRj!~T13<Z1;n*iyLPJ~uc1vD0CT=m)>*Z)q(54HQZi z9OnA`blFt@la`m?dAKIMJj+sNCvch3&Y*TnPmI>oXFp>vt<jw9U2mf*+PU2N(ZhSv zGW!K?@TFMD-k)vQb~n2Fqnp+N9;Y8nm*4H}_DGgZm7jP0xF5Td!_EKQ2b2$l)%H~y zAOCdgwD!jqEe9^1%*HJW*A8sa6y{)Gzv=(t?q4#-4GJ6npH}-|u)$eA-lW=Q{k|VE z^8#4gL=@IqFgiyGa2MRavYUf7>t_9v;M#S+8yN~7oL1VvQNjAbLYDj4os-*i_aD3+ z!5C3d#dGMxQwKM7o7gHP<#5MY33184rgXBrwtsx!cxax`^@iqnlg8r>x>i3bjgN2o z+j{@jgQcw#XZF6a>zJ=sJ+t<y_=-IN=ldoZsr8>!zpOoRV^x~ZT#p6oW;MI7f5H9g zuY>G|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