Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EventsAPIClient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jards
EventsAPIClient
Commits
69d8a588
Commit
69d8a588
authored
7 years ago
by
Carsten Karbach
Browse files
Options
Downloads
Patches
Plain Diff
Add SSL certificate support in configuration and api client
parent
884557ae
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/ApiClient.php
+6
-0
6 additions, 0 deletions
lib/ApiClient.php
lib/Configuration.php
+79
-0
79 additions, 0 deletions
lib/Configuration.php
with
85 additions
and
0 deletions
lib/ApiClient.php
+
6
−
0
View file @
69d8a588
...
...
@@ -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
());
}
...
...
This diff is collapsed.
Click to expand it.
lib/Configuration.php
+
79
−
0
View file @
69d8a588
...
...
@@ -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
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment