Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue with IdPMetadataParser only keeping 1 certificate when multiple certificates of a single type were provided. #250

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/Saml2/IdPMetadataParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,19 @@ public static function parseXML($xml, $entityId = null, $desiredNameIdFormat = n
}

$idpCertdata = $metadataInfo['idp']['x509certMulti'];
if (count($idpCertdata) == 1 || ((isset($idpCertdata['signing']) && count($idpCertdata['signing']) == 1) && isset($idpCertdata['encryption']) && count($idpCertdata['encryption']) == 1 && strcmp($idpCertdata['signing'][0], $idpCertdata['encryption'][0]) == 0)) {
if (
// Maximum of 1 signing certificate
(!isset($idpCertdata['signing']) || count($idpCertdata['signing']) == 1)
// Maximum of 1 encryption certificate
&& (!isset($idpCertdata['encryption']) || count($idpCertdata['encryption']) == 1)
// Either
&& (
// only 1 certificate total
count($idpCertdata) == 1
// or the only signing certificate matches the only encryption certificate
|| (isset($idpCertdata['signing'][0]) && isset($idpCertdata['encryption'][0]) && strcmp($idpCertdata['signing'][0], $idpCertdata['encryption'][0]) == 0)
)
) {
if (isset($metadataInfo['idp']['x509certMulti']['signing'][0])) {
$metadataInfo['idp']['x509cert'] = $metadataInfo['idp']['x509certMulti']['signing'][0];
} else {
Expand Down