Skip to content
Snippets Groups Projects
Commit 69d8a588 authored by Carsten Karbach's avatar Carsten Karbach
Browse files

Add SSL certificate support in configuration and api client

parent 884557ae
No related branches found
No related tags found
No related merge requests found
......@@ -179,6 +179,12 @@ class ApiClient
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
}
if(! empty($this->config->getCertificate())){
curl_setopt($curl, CURLOPT_SSLCERT, $this->config->getCertificate());
curl_setopt($curl, CURLOPT_SSLKEY, $this->config->getCertificateKey());
curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $this->config->getCertificatePassphrase());
}
if ($this->config->getCurlProxyHost()) {
curl_setopt($curl, CURLOPT_PROXY, $this->config->getCurlProxyHost());
}
......
......@@ -141,6 +141,24 @@ class Configuration
*/
protected $sslVerification = true;
/**
* Path to client certificate
* @var string path to client certificate
*/
protected $certificate = null;
/**
* Path to client certificate key file
* @var string path to client certificate key file
*/
protected $certificateKey = null;
/**
* passphrase for the certificate key file
* @var string passphrase for the certificate key file
*/
protected $certificatePassphrase = null;
/**
* Curl proxy host
*
......@@ -691,6 +709,67 @@ class Configuration
return $this->sslVerification;
}
/**
* Sets certificate file for client certificate
*
* @param string $certificate path to client certificate
* @return Configuration
*/
public function setCertificate($certificate)
{
$this->certificate = $certificate;
return $this;
}
/**
*
* @return string certificate file for client certificate
*/
public function getCertificate()
{
return $this->certificate;
}
/**
* Set certificate key file
* @param string $certificatekey certificate key file
* @return \Swagger\Client\Configuration
*/
public function setCertificateKey($certificatekey)
{
$this->certificateKey = $certificatekey;
return $this;
}
/**
*
* @return string certificate key file
*/
public function getCertificateKey()
{
return $this->certificateKey;
}
/**
* Set passphrase for client certificate key file
* @param string $passphrase passphrase for client certificate key file
* @return \Swagger\Client\Configuration
*/
public function setCertificatePassphrase($passphrase)
{
$this->certificatePassphrase = $passphrase;
return $this;
}
/**
*
* @return string passphrase for client certificate key file
*/
public function getCertificatePassphrase()
{
return $this->certificatePassphrase;
}
/**
* Gets the default configuration instance
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment