Skip to content

Commit

Permalink
Merge pull request #246 from silinternational/feature/instantiate-utils
Browse files Browse the repository at this point in the history
instantiate SimpleSAML\Utils classes
  • Loading branch information
briskt authored Jul 8, 2024
2 parents 6945cda + cf239c1 commit dfc6b6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
18 changes: 9 additions & 9 deletions modules/sildisco/public/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
require_once('../public/_include.php');

use SAML2\Constants;
use SimpleSAML\Utils\Config\Metadata as Metadata;
use SimpleSAML\Utils\Crypto as Crypto;
use SimpleSAML\Utils\HTTP as HTTP;
use SimpleSAML\Utils;

// load SimpleSAMLphp, configuration and metadata
$config = \SimpleSAML\Configuration::getInstance();
Expand All @@ -19,7 +17,7 @@
}

// check if valid local session exists
//$authUtils = new Auth();
//$authUtils = new Utils\Auth();
//if ($config->getOptionalBoolean('admin.protectmetadata', false)) {
// $authUtils->requireAdmin();
//}
Expand All @@ -32,7 +30,7 @@

$availableCerts = array();

$cryptoUtils = new Crypto();
$cryptoUtils = new Utils\Crypto();

$keys = array();
$certInfo = $cryptoUtils->loadPublicKey($idpmeta, false, 'new_');
Expand Down Expand Up @@ -114,7 +112,7 @@
$metaArray['keys'] = $keys;
}

$httpUtils = new HTTP();
$httpUtils = new Utils\HTTP();

if ($idpmeta->getOptionalBoolean('saml20.sendartifact', false)) {
// Artifact sending enabled
Expand Down Expand Up @@ -156,11 +154,13 @@
$metaArray['scope'] = $idpmeta->getArray('scope');
}

$metadataUtils = new Utils\Metadata();

if ($idpmeta->hasValue('EntityAttributes')) {
$metaArray['EntityAttributes'] = $idpmeta->getArray('EntityAttributes');

// check for entity categories
if (Metadata::isHiddenFromDiscovery($metaArray)) {
if ($metadataUtils->isHiddenFromDiscovery($metaArray)) {
$metaArray['hide.from.discovery'] = true;
}
}
Expand Down Expand Up @@ -188,7 +188,7 @@
if ($idpmeta->hasValue('contacts')) {
$contacts = $idpmeta->getArray('contacts');
foreach ($contacts as $contact) {
$metaArray['contacts'][] = Metadata::getContact($contact);
$metaArray['contacts'][] = $metadataUtils->getContact($contact);
}
}

Expand All @@ -197,7 +197,7 @@
$techcontact['emailAddress'] = $technicalContactEmail;
$techcontact['name'] = $config->getOptionalString('technicalcontact_name', null);
$techcontact['contactType'] = 'technical';
$metaArray['contacts'][] = Metadata::getContact($techcontact);
$metaArray['contacts'][] = $metadataUtils->getContact($techcontact);
}

$metaBuilder = new \SimpleSAML\Metadata\SAMLBuilder($idpentityid);
Expand Down
3 changes: 2 additions & 1 deletion modules/sildisco/public/sp/saml2-logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@

\SimpleSAML\Module\saml\Message::validateMessage($idpMetadata, $spMetadata, $message);

$httpUtils = new \SimpleSAML\Utils\HTTP();
$destination = $message->getDestination();
if ($destination !== null && $destination !== \SimpleSAML\Utils\HTTP::getSelfURLNoQuery()) {
if ($destination !== null && $destination !== $httpUtils->getSelfURLNoQuery()) {
throw new \SimpleSAML\Error\Exception('Destination in logout message is wrong.');
}

Expand Down

0 comments on commit dfc6b6e

Please sign in to comment.