Skip to content

Commit

Permalink
#586 IdPMetadataParser::parseRemoteXML - Add argument for setting whe…
Browse files Browse the repository at this point in the history
…ther to validate peer SSL certificate
  • Loading branch information
pitbulk committed May 13, 2024
1 parent a562997 commit 9dbe364
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Saml2/IdPMetadataParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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);
Expand Down

0 comments on commit 9dbe364

Please sign in to comment.