Skip to content

Commit

Permalink
remove "beta test" feature
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed Jul 10, 2024
1 parent 43655a4 commit 049ee75
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 113 deletions.
4 changes: 0 additions & 4 deletions development/hub/metadata/idp-remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand All @@ -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)',
Expand All @@ -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)',
Expand All @@ -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',
Expand Down
15 changes: 0 additions & 15 deletions modules/sildisco/public/betatest.php

This file was deleted.

43 changes: 1 addition & 42 deletions modules/sildisco/src/IdPDisco.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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';

Expand Down Expand Up @@ -74,7 +67,7 @@ private function getSPEntityIDAndReducedIdpList(): array
);
}

return array($spEntityId, self::enableBetaEnabled($idpList));
return array($spEntityId, $idpList);
}

/**
Expand Down Expand Up @@ -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
*/
Expand Down
52 changes: 0 additions & 52 deletions tests/IdpDiscoTest.php

This file was deleted.

0 comments on commit 049ee75

Please sign in to comment.