From 049ee758e8554a5008fdbf376b5431175c656ce2 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:40:26 -0600 Subject: [PATCH] remove "beta test" feature --- development/hub/metadata/idp-remote.php | 4 -- modules/sildisco/public/betatest.php | 15 ------- modules/sildisco/src/IdPDisco.php | 43 +------------------- tests/IdpDiscoTest.php | 52 ------------------------- 4 files changed, 1 insertion(+), 113 deletions(-) delete mode 100644 modules/sildisco/public/betatest.php delete mode 100644 tests/IdpDiscoTest.php diff --git a/development/hub/metadata/idp-remote.php b/development/hub/metadata/idp-remote.php index 68c1789..cfb91c1 100644 --- a/development/hub/metadata/idp-remote.php +++ b/development/hub/metadata/idp-remote.php @@ -66,7 +66,6 @@ 'IDPNamespace' => 'IDP-2-custom-port', 'logoCaption' => 'IDP-2:8086 staff', 'enabled' => true, - 'betaEnabled' => true, 'logoURL' => 'https://dummyimage.com/125x125/0f4fbd/ffffff.png&text=IDP+2+8086', 'description' => 'Local IDP2 for testing SSP Hub (custom port)', @@ -87,7 +86,6 @@ 'IDPNamespace' => 'IDP-2', 'logoCaption' => 'IDP-2 staff', 'enabled' => true, - 'betaEnabled' => true, 'logoURL' => 'https://dummyimage.com/125x125/0f4fbd/ffffff.png&text=IDP+2', 'description' => 'Local IDP2 for testing SSP Hub (normal port)', @@ -112,7 +110,6 @@ 'IDPNamespace' => 'IDP-3-custom-port', 'logoCaption' => 'IDP-3:8087 staff', 'enabled' => false, - 'betaEnabled' => true, 'logoURL' => 'https://dummyimage.com/125x125/0f4fbd/ffffff.png&text=IDP+3+8087', 'description' => 'Local IDP3 for testing SSP Hub (custom port)', @@ -130,7 +127,6 @@ 'IDPNamespace' => 'IDP-3', 'logoCaption' => 'IDP-3 staff', 'enabled' => false, - 'betaEnabled' => true, 'logoURL' => 'https://dummyimage.com/125x125/0f4fbd/ffffff.png&text=IDP+3', 'description' => 'Local IDP3 for testing SSP Hub', diff --git a/modules/sildisco/public/betatest.php b/modules/sildisco/public/betatest.php deleted file mode 100644 index fd15942..0000000 --- a/modules/sildisco/public/betatest.php +++ /dev/null @@ -1,15 +0,0 @@ -setData($sessionType, $sessionKey, 1, Session::DATA_TIMEOUT_SESSION_END); - -echo "
You have been given a cookie to allow you to test beta-enabled IDPs.
"; -echo "To remove the cookie, just close your browser.
"; diff --git a/modules/sildisco/src/IdPDisco.php b/modules/sildisco/src/IdPDisco.php index eefdd9f..770cc12 100644 --- a/modules/sildisco/src/IdPDisco.php +++ b/modules/sildisco/src/IdPDisco.php @@ -7,7 +7,6 @@ use Sil\SspUtils\Metadata; use SimpleSAML\Auth; use SimpleSAML\Logger; -use SimpleSAML\Session; use SimpleSAML\Utils\HTTP; use SimpleSAML\XHTML\IdPDisco as SSPIdPDisco; use SimpleSAML\XHTML\Template; @@ -26,12 +25,6 @@ class IdPDisco extends SSPIdPDisco /* The session type for this class */ public static string $sessionType = 'sildisco:authentication'; - /* The session key for checking if the current user has the beta_tester cookie */ - public static string $betaTesterSessionKey = 'beta_tester'; - - /* The idp metadata key that says whether an IDP is betaEnabled */ - public static string $betaEnabledMdKey = 'betaEnabled'; - /* The idp metadata key that says whether an IDP is enabled */ public static string $enabledMdKey = 'enabled'; @@ -74,7 +67,7 @@ private function getSPEntityIDAndReducedIdpList(): array ); } - return array($spEntityId, self::enableBetaEnabled($idpList)); + return array($spEntityId, $idpList); } /** @@ -135,40 +128,6 @@ public function handleRequest(): void $t->send(); } - /** - * @param array $idpList the IDPs with their metadata - * @param bool|null $isBetaTester optional (default=null) just for unit testing - * @return array $idpList - * - * If the current user has the beta_tester cookie, then for each IDP in - * the idpList that has 'betaEnabled' => true, give it 'enabled' => true - * - */ - public static function enableBetaEnabled(array $idpList, ?bool $isBetaTester = null): array - { - - if ($isBetaTester === null) { - $session = Session::getSessionFromRequest(); - $isBetaTester = $session->getData( - self::$sessionType, - self::$betaTesterSessionKey - ); - } - - if (!$isBetaTester) { - return $idpList; - } - - foreach ($idpList as $idp => $idpMetadata) { - if (!empty($idpMetadata[self::$betaEnabledMdKey])) { - $idpMetadata[self::$enabledMdKey] = true; - $idpList[$idp] = $idpMetadata; - } - } - - return $idpList; - } - /** * @inheritDoc */ diff --git a/tests/IdpDiscoTest.php b/tests/IdpDiscoTest.php deleted file mode 100644 index 4d6fa5f..0000000 --- a/tests/IdpDiscoTest.php +++ /dev/null @@ -1,52 +0,0 @@ -assertEquals($expected, $results); -// } -// -// public function testEnableBetaEnabledNoChange() -// { -// $isBetaEnabled = 1; -// $enabledKey = IdPDisco::$enabledMdKey; -// $idpList = [ -// 'idp1' => [$enabledKey => false], -// 'idp2' => [$enabledKey => true], -// ]; -// $expected = $idpList; -// -// $results = IdPDisco::enableBetaEnabled($idpList, $isBetaEnabled); -// $this->assertEquals($expected, $results); -// } -// -// public function testEnableBetaEnabledChange() -// { -// $isBetaEnabled = 1; -// $enabledKey = IdPDisco::$enabledMdKey; -// $betaEnabledKey = IdPDisco::$betaEnabledMdKey; -// $idpList = [ -// 'idp1' => [$enabledKey => false], -// 'idp2' => [$enabledKey => true, $betaEnabledKey => true], -// 'idp3' => [$enabledKey => false, $betaEnabledKey => true], -// 'idp4' => [$enabledKey => false, $betaEnabledKey => false], -// ]; -// $expected = $idpList; -// $expected['idp3'][$enabledKey] = true; -// -// $results = IdPDisco::enableBetaEnabled($idpList, $isBetaEnabled); -// $this->assertEquals($expected, $results); -// } - -}