From c8a70bff80b4e05d1833e5158893a466d543744b Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Fri, 27 Aug 2021 22:47:30 +0200 Subject: [PATCH] Remove old www-scripts --- modules/exampleauth/www/authpage.php | 87 ------------------------ modules/exampleauth/www/redirecttest.php | 18 ----- modules/exampleauth/www/resume.php | 14 ---- 3 files changed, 119 deletions(-) delete mode 100644 modules/exampleauth/www/authpage.php delete mode 100644 modules/exampleauth/www/redirecttest.php delete mode 100644 modules/exampleauth/www/resume.php diff --git a/modules/exampleauth/www/authpage.php b/modules/exampleauth/www/authpage.php deleted file mode 100644 index c1ab81bfc..000000000 --- a/modules/exampleauth/www/authpage.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php - -/** - * This page serves as a dummy login page. - * - * Note that we don't actually validate the user in this example. This page - * just serves to make the example work out of the box. - * - * @package SimpleSAMLphp - */ - -if (!isset($_REQUEST['ReturnTo'])) { - die('Missing ReturnTo parameter.'); -} - -$httpUtils = new \SimpleSAML\Utils\HTTP(); -$returnTo = $httpUtils->checkURLAllowed($_REQUEST['ReturnTo']); - -/** - * The following piece of code would never be found in a real authentication page. Its - * purpose in this example is to make this example safer in the case where the - * administrator of the IdP leaves the exampleauth-module enabled in a production - * environment. - * - * What we do here is to extract the $state-array identifier, and check that it belongs to - * the exampleauth:External process. - */ -if (!preg_match('@State=(.*)@', $returnTo, $matches)) { - die('Invalid ReturnTo URL for this example.'); -} - -/** - * The loadState-function will not return if the second parameter does not - * match the parameter passed to saveState, so by now we know that we arrived here - * through the exampleauth:External authentication page. - */ -\SimpleSAML\Auth\State::loadState(urldecode($matches[1]), 'exampleauth:External'); - -// our list of users. -$users = [ - 'student' => [ - 'password' => 'student', - 'uid' => 'student', - 'name' => 'Student Name', - 'mail' => 'somestudent@example.org', - 'type' => 'student', - ], - 'admin' => [ - 'password' => 'admin', - 'uid' => 'admin', - 'name' => 'Admin Name', - 'mail' => 'someadmin@example.org', - 'type' => 'employee', - ], -]; - -// time to handle login responses; since this is a dummy example, we accept any data -$badUserPass = false; -if ($_SERVER['REQUEST_METHOD'] === 'POST') { - $username = (string) $_REQUEST['username']; - $password = (string) $_REQUEST['password']; - - if (!isset($users[$username]) || $users[$username]['password'] !== $password) { - $badUserPass = true; - } else { - $user = $users[$username]; - - if (!session_id()) { - // session_start not called before. Do it here. - session_start(); - } - - $_SESSION['uid'] = $user['uid']; - $_SESSION['name'] = $user['name']; - $_SESSION['mail'] = $user['mail']; - $_SESSION['type'] = $user['type']; - - $httpUtils->redirectTrustedURL($returnTo); - } -} - -// if we get this far, we need to show the login page to the user -$config = \SimpleSAML\Configuration::getInstance(); -$t = new \SimpleSAML\XHTML\Template($config, 'exampleauth:authenticate.twig'); -$t->data['badUserPass'] = $badUserPass; -$t->data['returnTo'] = $returnTo; -$t->send(); diff --git a/modules/exampleauth/www/redirecttest.php b/modules/exampleauth/www/redirecttest.php deleted file mode 100644 index 373c8527f..000000000 --- a/modules/exampleauth/www/redirecttest.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -/** - * Request handler for redirect filter test. - * - * @package SimpleSAMLphp - */ - -if (!array_key_exists('StateId', $_REQUEST)) { - throw new \SimpleSAML\Error\BadRequest('Missing required StateId query parameter.'); -} - -/** @var array $state */ -$state = \SimpleSAML\Auth\State::loadState($_REQUEST['StateId'], 'exampleauth:redirectfilter-test'); - -$state['Attributes']['RedirectTest2'] = ['OK']; - -\SimpleSAML\Auth\ProcessingChain::resumeProcessing($state); diff --git a/modules/exampleauth/www/resume.php b/modules/exampleauth/www/resume.php deleted file mode 100644 index 192c13a20..000000000 --- a/modules/exampleauth/www/resume.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -/** - * This page serves as the point where the user's authentication - * process is resumed after the login page. - * - * It simply passes control back to the class. - * - * @package SimpleSAMLphp - */ - -namespace SimpleSAML\Module\exampleauth\Auth\Source; - -External::resume(); -- GitLab