Skip to content

Commit

Permalink
remove the feature to disable an IdP
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed Jul 17, 2024
1 parent d84aaab commit 8374636
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 74 deletions.
6 changes: 0 additions & 6 deletions development/hub/metadata/idp-remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
],
'IDPNamespace' => 'IDP-1-custom-port',
'logoCaption' => 'IDP-1:8085 staff',
'enabled' => true,
'logoURL' => 'https://dummyimage.com/125x125/0f4fbd/ffffff.png&text=IDP+1+8085',

'description' => 'Local IDP for testing SSP Hub (custom port)',
Expand All @@ -39,7 +38,6 @@
],
'IDPNamespace' => 'IDP-1',
'logoCaption' => 'IDP-1 staff',
'enabled' => true,
'logoURL' => 'https://dummyimage.com/125x125/0f4fbd/ffffff.png&text=IDP+1',

'description' => 'Local IDP for testing SSP Hub (default port)',
Expand All @@ -65,7 +63,6 @@
],
'IDPNamespace' => 'IDP-2-custom-port',
'logoCaption' => 'IDP-2:8086 staff',
'enabled' => true,
'logoURL' => 'https://dummyimage.com/125x125/0f4fbd/ffffff.png&text=IDP+2+8086',

'description' => 'Local IDP2 for testing SSP Hub (custom port)',
Expand All @@ -85,7 +82,6 @@
],
'IDPNamespace' => 'IDP-2',
'logoCaption' => 'IDP-2 staff',
'enabled' => true,
'logoURL' => 'https://dummyimage.com/125x125/0f4fbd/ffffff.png&text=IDP+2',

'description' => 'Local IDP2 for testing SSP Hub (normal port)',
Expand All @@ -109,7 +105,6 @@
],
'IDPNamespace' => 'IDP-3-custom-port',
'logoCaption' => 'IDP-3:8087 staff',
'enabled' => false,
'logoURL' => 'https://dummyimage.com/125x125/0f4fbd/ffffff.png&text=IDP+3+8087',

'description' => 'Local IDP3 for testing SSP Hub (custom port)',
Expand All @@ -126,7 +121,6 @@
],
'IDPNamespace' => 'IDP-3',
'logoCaption' => 'IDP-3 staff',
'enabled' => false,
'logoURL' => 'https://dummyimage.com/125x125/0f4fbd/ffffff.png&text=IDP+3',

'description' => 'Local IDP3 for testing SSP Hub',
Expand Down
29 changes: 1 addition & 28 deletions modules/material/themes/material/default/selectidp-links.twig
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<input type="hidden" name="return" value="{{ return|e('html_attr') }}"/>
<input type="hidden" name="returnIDParam" value="{{ return_id_param|e('html_attr') }}"/>

{% for idp in enabled_idps %}
{% for idp in idp_list %}
<div
class="mdl-card mdl-shadow--8dp row-aware"
title="{{ '{selectidp-links:enabled}'|trans({'%idpName%': idp|entityDisplayName}) }}"
Expand All @@ -78,36 +78,9 @@
</div>
{% endfor %}

{% for idp in disabled_idps %}
<div
class="mdl-card mdl-shadow--2dp disabled row-aware"
title="{{ '{selectidp-links:disabled}'|trans({'%idpName%': idp|entityDisplayName}) }}"
onclick="clickedAnyway('{{ idp|entityDisplayName }}')"
>
<div class="mdl-card__media white-bg fixed-height" layout-children="row" child-spacing="center">
<div class="logo-container fill-parent">
<div class="image-wrapper">
<img
class="logo"
id="{{ idp.entityid|e }}"
src="{{ idp.logoURL|default('default-logo.png') }}"
>
</div>
<span class="mdl-color-text--grey-600 logo-caption">
{{ idp.logoCaption|e|default('<br>') }}
</span>
</div>
</div>
</div>
{% endfor %}
</form>
</main>

<script>
ga('send', 'event', 'hub', 'choices', 'enabled', {{ enabled_idps|length }});
ga('send', 'event', 'hub', 'choices', 'disabled', {{ disabled_idps|length }});
</script>

{{ include('footer.twig') }}
</div>
<style>
Expand Down
22 changes: 2 additions & 20 deletions modules/sildisco/src/IdPDisco.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ class IdPDisco extends SSPIdPDisco
/* The session type for this class */
public static string $sessionType = 'sildisco:authentication';

/* The idp metadata key that says whether an IDP is enabled */
public static string $enabledMdKey = 'enabled';

/**
* @inheritDoc
*/
Expand Down Expand Up @@ -103,22 +100,7 @@ public function handleRequest(): void

$t = new Template($this->config, 'selectidp-links', 'disco');

// in order to bypass some built-in simplesaml behavior, an extra idp
// might've been added. It's not meant to be displayed.
unset($idpList['dummy']);

$enabledIdps = [];
$disabledIdps = [];
foreach ($idpList as $idp) {
if ($idp['enabled'] === true) {
$enabledIdps[] = $idp;
} else {
$disabledIdps[] = $idp;
}
}

$t->data['enabled_idps'] = $enabledIdps;
$t->data['disabled_idps'] = $disabledIdps;
$t->data['idp_list'] = $idpList;
$t->data['return'] = $this->returnURL;
$t->data['return_id_param'] = $this->returnIdParam;
$t->data['entity_id'] = $this->spEntityId;
Expand Down Expand Up @@ -167,7 +149,7 @@ protected function validateIdP(?string $idp): ?string
return null;
}

if (array_key_exists($idp, $idpList) && $idpList[$idp]['enabled']) {
if (array_key_exists($idp, $idpList)) {
return $idp;
}
$this->log('Invalid IdP entity id [' . $idp . '] received from discovery page.');
Expand Down
21 changes: 1 addition & 20 deletions tests/MetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use PHPUnit\Framework\TestCase;
use Sil\PhpEnv\Env;
use Sil\SspUtils\Metadata;
use Sil\SspUtils\DiscoUtils;
use Sil\SspUtils\Metadata;
use Sil\SspUtils\Utils;

class MetadataTest extends TestCase
Expand Down Expand Up @@ -339,25 +339,6 @@ public function testMetadataSPWithNoName()
var_export($badSps, True));
}

public function testMetadataWithBadEnabled()
{
$idpEntries = Metadata::getIdpMetadataEntries($this->metadataPath);
$enabledKey = 'enabled';
$badEnabled = [];

foreach ($idpEntries as $idpEntityId => $idpEntry) {
if (!isset($idpEntry[$enabledKey]) ||
!is_bool($idpEntry[$enabledKey])) {
$badEnabled[] = $idpEntityId;
}
}

$this->assertTrue(empty($badEnabled),
"The following Idp's do not have a boolean '" . $enabledKey . "' entry ... " .
var_export($badEnabled, True));
}


public function testMetadataCerts()
{
$spEntries = Metadata::getSpMetadataEntries($this->metadataPath);
Expand Down

0 comments on commit 8374636

Please sign in to comment.