Skip to content
Snippets Groups Projects
Commit 43130853 authored by Thijs Kinkhorst's avatar Thijs Kinkhorst
Browse files

admin: Fix metadata urls when having >1 IdP

The metadata endpoint requires an entityID, not authsource to find
the corresponding IdP. Which makes sense because that is the unique
identifier - different IdPs can make use of the same backend auth
source.
parent edb7699d
No related branches found
No related tags found
No related merge requests found
...@@ -193,18 +193,19 @@ class Federation ...@@ -193,18 +193,19 @@ class Federation
try { try {
$idps = $this->mdHandler->getList('saml20-idp-hosted'); $idps = $this->mdHandler->getList('saml20-idp-hosted');
$saml2entities = []; $saml2entities = [];
$httpUtils = new Utils\HTTP();
$metadataBase = $httpUtils->getBaseURL() . 'saml2/idp/metadata.php';
if (count($idps) > 1) { if (count($idps) > 1) {
foreach ($idps as $index => $idp) { foreach ($idps as $index => $idp) {
$idp['url'] = Module::getModuleURL('saml2/idp/metadata/' . $idp['auth']); $idp['url'] = $metadataBase . '?idpentityid=' . urlencode($idp['entityid']);
$idp['metadata-set'] = 'saml20-idp-hosted'; $idp['metadata-set'] = 'saml20-idp-hosted';
$idp['metadata-index'] = $index; $idp['metadata-index'] = $index;
$idp['metadata_array'] = SAML2_IdP::getHostedMetadata($idp['entityid']); $idp['metadata_array'] = SAML2_IdP::getHostedMetadata($idp['entityid']);
$saml2entities[] = $idp; $saml2entities[] = $idp;
} }
} else { } else {
$httpUtils = new Utils\HTTP();
$saml2entities['saml20-idp'] = $this->mdHandler->getMetaDataCurrent('saml20-idp-hosted'); $saml2entities['saml20-idp'] = $this->mdHandler->getMetaDataCurrent('saml20-idp-hosted');
$saml2entities['saml20-idp']['url'] = $httpUtils->getBaseURL() . 'saml2/idp/metadata.php'; $saml2entities['saml20-idp']['url'] = $metadataBase;
$saml2entities['saml20-idp']['metadata_array'] = SAML2_IdP::getHostedMetadata( $saml2entities['saml20-idp']['metadata_array'] = SAML2_IdP::getHostedMetadata(
$this->mdHandler->getMetaDataCurrentEntityID('saml20-idp-hosted') $this->mdHandler->getMetaDataCurrentEntityID('saml20-idp-hosted')
); );
...@@ -234,7 +235,7 @@ class Federation ...@@ -234,7 +235,7 @@ class Federation
$adfsentities = []; $adfsentities = [];
if (count($idps) > 1) { if (count($idps) > 1) {
foreach ($idps as $index => $idp) { foreach ($idps as $index => $idp) {
$idp['url'] = Module::getModuleURL('adfs/idp/metadata/' . $idp['auth']); $idp['url'] = Module::getModuleURL('adfs/idp/metadata/?idpentityid=' . urlencode($idp['entityid']));
$idp['metadata-set'] = 'adfs-idp-hosted'; $idp['metadata-set'] = 'adfs-idp-hosted';
$idp['metadata-index'] = $index; $idp['metadata-index'] = $index;
$idp['metadata_array'] = ADFS_IdP::getHostedMetadata($idp['entityid']); $idp['metadata_array'] = ADFS_IdP::getHostedMetadata($idp['entityid']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment