Skip to content

Commit 4fcd5e1

Browse files
committed
Merge branch 'samlp-interface'
2 parents 14a4b42 + 12ec8f0 commit 4fcd5e1

File tree

8 files changed

+132
-167
lines changed

8 files changed

+132
-167
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"psr/log": "^2.0 || ^3.0",
6868
"robrichards/xmlseclibs": "^3.1.1",
6969
"simplesamlphp/assert": "^1.0.0",
70-
"simplesamlphp/saml2": "^5.0.0-alpha.6",
70+
"simplesamlphp/saml2": "^v5.0.0-alpha.8",
7171
"simplesamlphp/simplesamlphp-assets-base": "^2.0.0",
7272
"simplesamlphp/simplesamlphp-module-adfs": "^3.0.0-rc1",
7373
"symfony/cache": "^5.4||^6",

composer.lock

Lines changed: 49 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/saml/src/Auth/Source/SP.php

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use SimpleSAML\SAML2\Exception\Protocol\{NoAvailableIDPException, NoPassiveException, NoSupportedIDPException};
1515
use SimpleSAML\SAML2\XML\md\ContactPerson;
1616
use SimpleSAML\SAML2\XML\saml\NameID;
17+
use SimpleSAML\SAML2\XML\samlp\{Extensions, IDPEntry, IDPList, RequesterID, Scoping};
1718
use SimpleSAML\Store\StoreFactory;
1819
use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;
1920
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
@@ -564,46 +565,57 @@ private function startSSO2(Configuration $idpMetadata, array $state): Response
564565
$ar->setNameIdPolicy($state['saml:NameIDPolicy']);
565566
}
566567

568+
$proxyCount = $idpList = null;
567569
$requesterID = [];
568570

569571
/* Only check for real info for Scoping element if we are going to send Scoping element */
570572
if ($this->disable_scoping !== true && $idpMetadata->getOptionalBoolean('disable_scoping', false) !== true) {
573+
$idpEntry = [];
571574
if (isset($state['IDPList'])) {
572-
$ar->setIDPList($state['IDPList']);
575+
$idpList = $state['IDPList'];
573576
} elseif (!empty($this->metadata->getOptionalArray('IDPList', []))) {
574-
$ar->setIDPList($this->metadata->getArray('IDPList'));
577+
foreach ($this->metadata->getArray('IDPList') as $entry) {
578+
$idpEntry[] = new IDPEntry($entry);
579+
}
580+
$idpList = new IDPList($idpEntry);
575581
} elseif (!empty($idpMetadata->getOptionalArray('IDPList', []))) {
576-
$ar->setIDPList($idpMetadata->getArray('IDPList'));
582+
foreach ($idpMetadata->getArray('IDPList') as $entry) {
583+
$idpEntry[] = new IDPEntry($entry);
584+
}
585+
$idpList = new IDPList($idpEntry);
577586
}
578587

579588
if (isset($state['saml:ProxyCount']) && $state['saml:ProxyCount'] !== null) {
580-
$ar->setProxyCount($state['saml:ProxyCount']);
589+
$proxyCount = $state['saml:ProxyCount'];
581590
} elseif ($idpMetadata->hasValue('ProxyCount')) {
582-
$ar->setProxyCount($idpMetadata->getInteger('ProxyCount'));
591+
$proxyCount = $idpMetadata->getInteger('ProxyCount');
583592
} elseif ($this->metadata->hasValue('ProxyCount')) {
584-
$ar->setProxyCount($this->metadata->getInteger('ProxyCount'));
593+
$proxyCount = $this->metadata->getInteger('ProxyCount');
585594
}
586595

587596
$requesterID = [];
588597
if (isset($state['saml:RequesterID'])) {
589-
$requesterID = $state['saml:RequesterID'];
598+
foreach ($state['saml:RequesterID'] as $requesterId) {
599+
$requesterID[] = new RequesterID($requesterId);
600+
}
590601
}
591602

592603
if (isset($state['core:SP'])) {
593-
$requesterID[] = $state['core:SP'];
604+
$requesterID[] = new RequesterID($state['core:SP']);
594605
}
595606
} else {
596607
Logger::debug('Disabling samlp:Scoping for ' . var_export($idpMetadata->getString('entityid'), true));
597608
}
598609

599-
$ar->setRequesterID($requesterID);
610+
$scoping = new Scoping($proxyCount, $idpList, $requesterID);
611+
$ar->setScoping($scoping);
600612

601613
// If the downstream SP has set extensions then use them.
602614
// Otherwise use extensions that might be defined in the local SP (only makes sense in a proxy scenario)
603615
if (isset($state['saml:Extensions']) && count($state['saml:Extensions']) > 0) {
604-
$ar->setExtensions($state['saml:Extensions']);
616+
$ar->setExtensions(new Extensions($state['saml:Extensions']));
605617
} elseif ($this->metadata->getOptionalArray('saml:Extensions', null) !== null) {
606-
$ar->setExtensions($this->metadata->getArray('saml:Extensions'));
618+
$ar->setExtensions(new Extensions($this->metadata->getArray('saml:Extensions')));
607619
}
608620

609621
$providerName = $this->metadata->getOptionalString("ProviderName", null);
@@ -1014,9 +1026,9 @@ public function startSLO2(Configuration $config, array &$state): ?Response
10141026
$lr->setDestination($endpoint['Location']);
10151027

10161028
if (isset($state['saml:logout:Extensions']) && count($state['saml:logout:Extensions']) > 0) {
1017-
$lr->setExtensions($state['saml:logout:Extensions']);
1029+
$lr->setExtensions(new Extensions($state['saml:logout:Extensions']));
10181030
} elseif ($this->metadata->getOptionalArray('saml:logout:Extensions', null) !== null) {
1019-
$lr->setExtensions($this->metadata->getArray('saml:logout:Extensions'));
1031+
$lr->setExtensions(new Extensions($this->metadata->getArray('saml:logout:Extensions')));
10201032
}
10211033

10221034
$encryptNameId = $idpMetadata->getOptionalBoolean('nameid.encryption', null);

0 commit comments

Comments
 (0)