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

Add certificate support for event sending

parent 2650ddbd
Branches PullRequest_386
No related tags found
No related merge requests found
...@@ -8,16 +8,16 @@ ...@@ -8,16 +8,16 @@
"packages": [ "packages": [
{ {
"name": "jards/eventsapiclient", "name": "jards/eventsapiclient",
"version": "v2.1", "version": "v2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/CarstenKarbach/EventsAPIClient.git", "url": "https://github.com/CarstenKarbach/EventsAPIClient.git",
"reference": "884557aea5a532a28340b4ae31b1b82992eb89e3" "reference": "69d8a58854ea6a7cd822a568ba3b6aab70719f7d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/CarstenKarbach/EventsAPIClient/zipball/884557aea5a532a28340b4ae31b1b82992eb89e3", "url": "https://api.github.com/repos/CarstenKarbach/EventsAPIClient/zipball/69d8a58854ea6a7cd822a568ba3b6aab70719f7d",
"reference": "884557aea5a532a28340b4ae31b1b82992eb89e3", "reference": "69d8a58854ea6a7cd822a568ba3b6aab70719f7d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -60,10 +60,10 @@ ...@@ -60,10 +60,10 @@
"swagger" "swagger"
], ],
"support": { "support": {
"source": "https://github.com/CarstenKarbach/EventsAPIClient/tree/v2.1", "source": "https://github.com/CarstenKarbach/EventsAPIClient/tree/v2.2",
"issues": "https://github.com/CarstenKarbach/EventsAPIClient/issues" "issues": "https://github.com/CarstenKarbach/EventsAPIClient/issues"
}, },
"time": "2017-10-29T15:19:25+00:00" "time": "2017-11-06T10:22:24+00:00"
}, },
{ {
"name": "phpmailer/phpmailer", "name": "phpmailer/phpmailer",
......
...@@ -160,15 +160,28 @@ class EventManagement{ ...@@ -160,15 +160,28 @@ class EventManagement{
* @param string $name name of the event * @param string $name name of the event
* @param string $description description of the event * @param string $description description of the event
* @param string $baseURL the root URL of the event receiver REST API * @param string $baseURL the root URL of the event receiver REST API
* @param string $certFile path to certificate file to use or null to call URL without certificate
* @param string $certKey path to certificate key file, null to avoid usage of key
* @param string $certPassphrase path to passphrase file for key file, null for no passphrase
* *
* @return boolean true on success, false on error * @return boolean true on success, false on error
*/ */
public function sendEvent($name, $description, $baseURL='http://localhost/myapps/EventsAPI/rest/events'){ public function sendEvent($name, $description, $baseURL='http://localhost/myapps/EventsAPI/rest/events', $certFile = null, $certKey = null, $certPassphrase = null){
date_default_timezone_set ( 'Europe/Amsterdam' ); date_default_timezone_set ( 'Europe/Amsterdam' );
$apiClient = new \Swagger\Client\ApiClient (); $apiClient = new \Swagger\Client\ApiClient ();
$apiClient->getConfig ()->setHost ( $baseURL ); $apiClient->getConfig ()->setHost ( $baseURL );
if(! empty($certFile)){
$apiClient->getConfig ()->setCertificate($certFile);
}
if(! empty($certKey)){
$apiClient->getConfig ()->setCertificateKey($certKey);
}
if(! empty($certPassphrase)){
$apiClient->getConfig ()->setCertificatePassphrase($certPassphrase);
}
$eventsApi = new EventsApi($apiClient); $eventsApi = new EventsApi($apiClient);
$event = new Event(); $event = new Event();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment