diff --git a/src/Saml2/IdPMetadataParser.php b/src/Saml2/IdPMetadataParser.php index be532ae5..58c7a410 100644 --- a/src/Saml2/IdPMetadataParser.php +++ b/src/Saml2/IdPMetadataParser.php @@ -36,10 +36,11 @@ class IdPMetadataParser * @param string $desiredNameIdFormat If available on IdP metadata, use that nameIdFormat * @param string $desiredSSOBinding Parse specific binding SSO endpoint * @param string $desiredSLOBinding Parse specific binding SLO endpoint + * @param bool $validatePeer Enable or disable validate peer SSL certificate * * @return array metadata info in php-saml settings format */ - public static function parseRemoteXML($url, $entityId = null, $desiredNameIdFormat = null, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT) + public static function parseRemoteXML($url, $entityId = null, $desiredNameIdFormat = null, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT, $validatePeer = false) { $metadataInfo = array(); @@ -51,7 +52,7 @@ public static function parseRemoteXML($url, $entityId = null, $desiredNameIdForm curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $validatePeer); curl_setopt($ch, CURLOPT_FAILONERROR, 1); $xml = curl_exec($ch);