Skip to content

Commit

Permalink
Merge pull request #92 from alchemy-fr/feature/fix-certificate-issue
Browse files Browse the repository at this point in the history
Fix certificate issue
  • Loading branch information
xrousset78800 committed Nov 23, 2021
2 parents 1aa235f + fb91cf1 commit 7c61d64
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/PhraseanetSDK/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ public function __construct(GuzzleAdapter $adapter, $clientId, $secret)
$this->secret = $secret;
}

public function setSslVerification($sslVerification)
{
$this->adapter->setSslVerification($sslVerification);
}

/**
* Activate extended graph object by adding required accept headers.
* This results in bigger response message but less requests to get
Expand Down
14 changes: 14 additions & 0 deletions src/PhraseanetSDK/Http/GuzzleAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class GuzzleAdapter implements GuzzleAdapterInterface
/** @var ClientInterface */
private $guzzle;
private $extended = false;
private $sslVerification = false;

public function __construct(ClientInterface $guzzle)
{
Expand Down Expand Up @@ -86,6 +87,16 @@ public function isExtended()
return $this->extended;
}

/**
* Sets setSslVerification mode
*
* @param boolean $sslVerification
*/
public function setSslVerification($sslVerification)
{
$this->sslVerification = (boolean)$sslVerification;
}

/**
* Performs an HTTP request, returns the body response
*
Expand Down Expand Up @@ -114,6 +125,9 @@ public function call(
'Accept' => $this->extended ? 'application/vnd.phraseanet.record-extended+json' : 'application/json'
);

if(!$this->sslVerification) {
$this->guzzle->setSslVerification(false,false,0);
}
$request = $this->guzzle->createRequest($method, $path, array_merge($acceptHeader, $headers));
$this->addRequestParameters($request, $query, $postFields, $files);
$response = $request->send();
Expand Down

0 comments on commit 7c61d64

Please sign in to comment.