Skip to content

Commit

Permalink
instantiate SimpleSAML\Utils classes
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed Jul 3, 2024
1 parent fbf1a21 commit 847f4a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
21 changes: 10 additions & 11 deletions modules/sildisco/public/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
require_once('../public/_include.php');

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

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

// check if valid local session exists
//$authUtils = new Auth();
//if ($config->getBoolean('admin.protectmetadata', false)) {
//$authUtils = new Utils\Auth();
//if ($config->getOptionalBoolean('admin.protectmetadata', false)) {
// $authUtils->requireAdmin();
//}

Expand All @@ -33,7 +30,7 @@

$availableCerts = array();

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

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

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

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

$metadataUtils = 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 @@ -189,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 @@ -198,7 +197,7 @@
$techcontact['emailAddress'] = $technicalContactEmail;
$techcontact['name'] = $config->getString('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 847f4a6

Please sign in to comment.