Skip to content

Commit 2b7550e

Browse files
committed
Improve metadata injection on settings
1 parent 1f8ea5f commit 2b7550e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,7 @@ Configuration of the OneLogin PHP Toolkit
13071307
* `validateMetadata` - Validates an XML SP Metadata.
13081308
* `formatIdPCert` - Formats the IdP cert.
13091309
* `formatSPCert` - Formats the SP cert.
1310+
* `formatSPCertNew` - Formats the SP cert new.
13101311
* `formatSPKey` - Formats the SP private key.
13111312
* `getErrors` - Returns an array with the errors, the array is empty when
13121313
the settings is ok.

lib/Saml2/IdPMetadataParser.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,14 @@ public static function parseXML($xml, $entityId = null, $desiredNameIdFormat = n
196196
*/
197197
public static function injectIntoSettings($settings, $metadataInfo)
198198
{
199-
if (isset($metadataInfo['idp']) && isset($metadataInfo['idp']['x509certMulti']) && !empty($metadataInfo['idp']['x509certMulti'])) {
200-
if (isset($settings['idp']) && isset($settings['idp']['x509cert'])) {
199+
if (isset($metadataInfo['idp']) && isset($settings['idp'])) {
200+
if (isset($metadataInfo['idp']['x509certMulti']) && !empty($metadataInfo['idp']['x509certMulti']) && isset($settings['idp']['x509cert'])) {
201201
unset($settings['idp']['x509cert']);
202202
}
203+
204+
if (isset($metadataInfo['idp']['x509cert']) && !empty($metadataInfo['idp']['x509cert']) && isset($settings['idp']['x509certMulti'])) {
205+
unset($settings['idp']['x509certMulti']);
206+
}
203207
}
204208

205209
return array_replace_recursive($settings, $metadataInfo);

0 commit comments

Comments
 (0)