Skip to content

Commit d040880

Browse files
committed
#586 IdPMetadataParser::parseRemoteXML - Add argument for setting whether to validate peer SSL certificate
1 parent dd4b27a commit d040880

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Saml2/IdPMetadataParser.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ class IdPMetadataParser
3636
* @param string $desiredNameIdFormat If available on IdP metadata, use that nameIdFormat
3737
* @param string $desiredSSOBinding Parse specific binding SSO endpoint
3838
* @param string $desiredSLOBinding Parse specific binding SLO endpoint
39+
* @param bool $validatePeer Enable or disable validate peer SSL certificate
3940
*
4041
* @return array metadata info in php-saml settings format
4142
*/
42-
public static function parseRemoteXML($url, $entityId = null, $desiredNameIdFormat = null, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT)
43+
public static function parseRemoteXML($url, $entityId = null, $desiredNameIdFormat = null, $desiredSSOBinding = Constants::BINDING_HTTP_REDIRECT, $desiredSLOBinding = Constants::BINDING_HTTP_REDIRECT, $validatePeer = false)
4344
{
4445
$metadataInfo = array();
4546

@@ -51,7 +52,7 @@ public static function parseRemoteXML($url, $entityId = null, $desiredNameIdForm
5152
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
5253
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
5354
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
54-
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
55+
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $validatePeer);
5556
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
5657

5758
$xml = curl_exec($ch);

0 commit comments

Comments
 (0)