Skip to content

Commit

Permalink
Merge pull request #251 from silinternational/feature/remove-betatest
Browse files Browse the repository at this point in the history
remove "beta test" feature
  • Loading branch information
briskt authored Jul 11, 2024
2 parents b1e5bb1 + eb7d4ed commit fdf518a
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 135 deletions.
1 change: 0 additions & 1 deletion behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]
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
1 change: 0 additions & 1 deletion dockerbuild/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 0 additions & 7 deletions docs/the_hub.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ It is also used by the `TagGroup.php` Auth Proc to convert group names into the

`idp|<IDPNamespace>|<group name>`.

##### 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.

Expand Down
13 changes: 0 additions & 13 deletions features/ZSp1Idp1BetaSp1Idp3.feature

This file was deleted.

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 fdf518a

Please sign in to comment.