Skip to content

Commit ff32fa0

Browse files
committed
Expose certFile and keyFile configuration items to support mtls in php generated client
1 parent 156b255 commit ff32fa0

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

modules/openapi-generator/src/main/resources/php/Configuration.mustache

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,20 @@ class Configuration
115115
*/
116116
protected $tempFolderPath;
117117
118+
/**
119+
* Path to a certificate file, for mTLS
120+
*
121+
* @var string
122+
*/
123+
protected $certFile;
124+
125+
/**
126+
* Path to a key file, for mTLS
127+
*
128+
* @var string
129+
*/
130+
protected $keyFile;
131+
118132
/**
119133
* Constructor
120134
*/
@@ -388,6 +402,49 @@ class Configuration
388402
return $this->tempFolderPath;
389403
}
390404

405+
/**
406+
* Sets the certificate file path, for mTLS
407+
*
408+
* @return $this
409+
*/
410+
public function setCertFile($certFile)
411+
{
412+
$this->certFile = $certFile;
413+
return $this;
414+
}
415+
416+
/**
417+
* Gets the certificate file path, for mTLS
418+
*
419+
* @return string Certificate file path
420+
*/
421+
public function getCertFile()
422+
{
423+
return $this->certFile;
424+
}
425+
426+
/**
427+
* Sets the certificate key path, for mTLS
428+
*
429+
* @return $this
430+
*/
431+
public function setKeyFile($keyFile)
432+
{
433+
$this->keyFile = $keyFile;
434+
return $this;
435+
}
436+
437+
/**
438+
* Gets the certificate key path, for mTLS
439+
*
440+
* @return string Certificate key path
441+
*/
442+
public function getKeyFile()
443+
{
444+
return $this->keyFile;
445+
}
446+
447+
391448
/**
392449
* Gets the default configuration instance
393450
*

modules/openapi-generator/src/main/resources/php/api.mustache

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,14 @@ use {{invokerPackage}}\ObjectSerializer;
832832
}
833833
}
834834

835+
if ($this->config->getCertFile()) {
836+
$options[RequestOptions::CERT] = $this->config->getCertFile();
837+
}
838+
839+
if ($this->config->getKeyFile()) {
840+
$options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
841+
}
842+
835843
return $options;
836844
}
837845

0 commit comments

Comments
 (0)