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 1/2] 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 "

Start Beta Testing

"; -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); -// } - -} From eb7d4edbcc0f53e154653e69b7f9765319f64797 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Wed, 10 Jul 2024 14:46:06 -0600 Subject: [PATCH 2/2] remove beta-test tests --- behat.yml | 1 - dockerbuild/run-tests.sh | 1 - docs/the_hub.md | 7 ------- features/ZSp1Idp1BetaSp1Idp3.feature | 13 ------------- 4 files changed, 22 deletions(-) delete mode 100644 features/ZSp1Idp1BetaSp1Idp3.feature diff --git a/behat.yml b/behat.yml index 4ef546f..0fd106f 100644 --- a/behat.yml +++ b/behat.yml @@ -27,7 +27,6 @@ default: # - '%paths.base%//features//Sp2Idp2Sp1Idp2Sp3.feature' # - '%paths.base%//features//Sp3Idp1Sp1Idp1Sp2Idp2.feature' # - '%paths.base%//features//WwwMetadataCept.feature' -# - '%paths.base%//features//ZSp1Idp1BetaSp1Idp3.feature' status_features: paths: [ '%paths.base%//features//status.feature' ] contexts: [ 'StatusContext' ] diff --git a/dockerbuild/run-tests.sh b/dockerbuild/run-tests.sh index 37c21ec..77f9735 100755 --- a/dockerbuild/run-tests.sh +++ b/dockerbuild/run-tests.sh @@ -9,6 +9,5 @@ set -e /data/run-metadata-tests.sh ./vendor/bin/phpunit -v tests/AnnouncementTest.php -./vendor/bin/phpunit -v tests/IdpDiscoTest.php /data/run-integration-tests.sh diff --git a/docs/the_hub.md b/docs/the_hub.md index e366f45..e9bab58 100644 --- a/docs/the_hub.md +++ b/docs/the_hub.md @@ -21,13 +21,6 @@ It is also used by the `TagGroup.php` Auth Proc to convert group names into the `idp||`. -##### betaEnabled -An optional metadata entry is `betaEnabled`. -This will allow the IdP to be marked as `'enable' => true` when the user has a certain cookie ('beta_tester') that they would get from visiting `hub_domain/module.php/sildisco/betatest.php`. -The user would need to manually remove that cookie to be free of this effect. - -Sildisco does not otherwise deal with looking at the `'enable'` value. However, a theme for idp discovery may (e.g. simplesamlphp-module-material). - ##### SPList In order to limit access to an IdP to only certain SP's, add an `'SPList'` array entry to the metadata for the IdP. The values of this array should match the `entity_id` values from the `sp-remote.php` metadata. diff --git a/features/ZSp1Idp1BetaSp1Idp3.feature b/features/ZSp1Idp1BetaSp1Idp3.feature deleted file mode 100644 index b5d0709..0000000 --- a/features/ZSp1Idp1BetaSp1Idp3.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Ensure I don't see IdP 3 at first, but after I go to the Beta Tester page I can see and login through IdP 3. - - Scenario: Normally the IdP3 is disabled - When I go to the "SP1" login page - And the url should match "sildisco/disco.php" - Then the "div" element should contain "IdP 3 coming soon" - - Scenario: After going to the "Beta Test" page, IdP3 is available for use - When I go to "http://ssp-hub.local/module.php/sildisco/betatest.php" - And I go to the "SP1" login page - And I click on the "IDP 3" tile - And I log in using my "IDP 3" credentials - Then I should see "test_admin@idp3.org"