From c1c85acdb152a32d1b06aed23db327355778e194 Mon Sep 17 00:00:00 2001 From: Niko Heller Date: Fri, 5 Jul 2024 15:01:53 +0200 Subject: [PATCH] add bearer auth for profile endpoints --- .gitignore | 3 +++ composer.json | 2 +- docs/Api/DivisionsApi.md | 2 +- docs/Api/HealthApi.md | 2 +- docs/Api/NbApiApi.md | 2 +- docs/Api/OffboardingApi.md | 2 +- docs/Api/ProfilesApi.md | 42 ++++++++++++++++++++++++++++++-------- docs/Api/UsersApi.md | 2 +- lib/Configuration.php | 8 ++++---- lib/apis/ProfilesApi.php | 32 +++++++++++++++++++++++++++++ 10 files changed, 78 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 27831dc..868354e 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ composer.phar .openapi-generator .openapi-generator-ignore git_push.sh +.openapi-generator +.openapi-generator-ignore +git_push.sh diff --git a/composer.json b/composer.json index 0b1619d..70dbebc 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "verdigado/gruene-api-client", - "version": "0.4.0", + "version": "0.5.0", "description": "PHP client library for gruene api", "keywords": [ "openapitools", diff --git a/docs/Api/DivisionsApi.md b/docs/Api/DivisionsApi.md index fc0782a..8e948ee 100644 --- a/docs/Api/DivisionsApi.md +++ b/docs/Api/DivisionsApi.md @@ -1,6 +1,6 @@ # Verdigado\GrueneApiClient\DivisionsApi -All URIs are relative to http://127.0.0.1:5000, except if the operation defines another base path. +All URIs are relative to http://0.0.0.0:5000, except if the operation defines another base path. | Method | HTTP request | Description | | ------------- | ------------- | ------------- | diff --git a/docs/Api/HealthApi.md b/docs/Api/HealthApi.md index a35aef5..a982762 100644 --- a/docs/Api/HealthApi.md +++ b/docs/Api/HealthApi.md @@ -1,6 +1,6 @@ # Verdigado\GrueneApiClient\HealthApi -All URIs are relative to http://127.0.0.1:5000, except if the operation defines another base path. +All URIs are relative to http://0.0.0.0:5000, except if the operation defines another base path. | Method | HTTP request | Description | | ------------- | ------------- | ------------- | diff --git a/docs/Api/NbApiApi.md b/docs/Api/NbApiApi.md index 7d16bc5..6f90574 100644 --- a/docs/Api/NbApiApi.md +++ b/docs/Api/NbApiApi.md @@ -1,6 +1,6 @@ # Verdigado\GrueneApiClient\NbApiApi -All URIs are relative to http://127.0.0.1:5000, except if the operation defines another base path. +All URIs are relative to http://0.0.0.0:5000, except if the operation defines another base path. | Method | HTTP request | Description | | ------------- | ------------- | ------------- | diff --git a/docs/Api/OffboardingApi.md b/docs/Api/OffboardingApi.md index 6a34879..eb40e7b 100644 --- a/docs/Api/OffboardingApi.md +++ b/docs/Api/OffboardingApi.md @@ -1,6 +1,6 @@ # Verdigado\GrueneApiClient\OffboardingApi -All URIs are relative to http://127.0.0.1:5000, except if the operation defines another base path. +All URIs are relative to http://0.0.0.0:5000, except if the operation defines another base path. | Method | HTTP request | Description | | ------------- | ------------- | ------------- | diff --git a/docs/Api/ProfilesApi.md b/docs/Api/ProfilesApi.md index fb416e6..f1e1e7e 100644 --- a/docs/Api/ProfilesApi.md +++ b/docs/Api/ProfilesApi.md @@ -1,6 +1,6 @@ # Verdigado\GrueneApiClient\ProfilesApi -All URIs are relative to http://127.0.0.1:5000, except if the operation defines another base path. +All URIs are relative to http://0.0.0.0:5000, except if the operation defines another base path. | Method | HTTP request | Description | | ------------- | ------------- | ------------- | @@ -35,6 +35,9 @@ $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->se // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); +// Configure Bearer (JWT) authorization: bearer +$config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + $apiInstance = new Verdigado\GrueneApiClient\Api\ProfilesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. @@ -64,7 +67,7 @@ try { ### Authorization -[api_key](../../README.md#api_key) +[api_key](../../README.md#api_key), [bearer](../../README.md#bearer) ### HTTP request headers @@ -95,6 +98,9 @@ $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->se // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); +// Configure Bearer (JWT) authorization: bearer +$config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + $apiInstance = new Verdigado\GrueneApiClient\Api\ProfilesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. @@ -123,7 +129,7 @@ void (empty response body) ### Authorization -[api_key](../../README.md#api_key) +[api_key](../../README.md#api_key), [bearer](../../README.md#bearer) ### HTTP request headers @@ -154,6 +160,9 @@ $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->se // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); +// Configure Bearer (JWT) authorization: bearer +$config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + $apiInstance = new Verdigado\GrueneApiClient\Api\ProfilesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. @@ -182,7 +191,7 @@ void (empty response body) ### Authorization -[api_key](../../README.md#api_key) +[api_key](../../README.md#api_key), [bearer](../../README.md#bearer) ### HTTP request headers @@ -282,6 +291,9 @@ $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->se // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); +// Configure Bearer (JWT) authorization: bearer +$config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + $apiInstance = new Verdigado\GrueneApiClient\Api\ProfilesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. @@ -313,7 +325,7 @@ try { ### Authorization -[api_key](../../README.md#api_key) +[api_key](../../README.md#api_key), [bearer](../../README.md#bearer) ### HTTP request headers @@ -344,6 +356,9 @@ $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->se // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); +// Configure Bearer (JWT) authorization: bearer +$config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + $apiInstance = new Verdigado\GrueneApiClient\Api\ProfilesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. @@ -370,7 +385,7 @@ This endpoint does not need any parameter. ### Authorization -[api_key](../../README.md#api_key) +[api_key](../../README.md#api_key), [bearer](../../README.md#bearer) ### HTTP request headers @@ -401,6 +416,9 @@ $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->se // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); +// Configure Bearer (JWT) authorization: bearer +$config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + $apiInstance = new Verdigado\GrueneApiClient\Api\ProfilesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. @@ -430,7 +448,7 @@ try { ### Authorization -[api_key](../../README.md#api_key) +[api_key](../../README.md#api_key), [bearer](../../README.md#bearer) ### HTTP request headers @@ -463,6 +481,9 @@ $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->se // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); +// Configure Bearer (JWT) authorization: bearer +$config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + $apiInstance = new Verdigado\GrueneApiClient\Api\ProfilesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. @@ -493,7 +514,7 @@ void (empty response body) ### Authorization -[api_key](../../README.md#api_key) +[api_key](../../README.md#api_key), [bearer](../../README.md#bearer) ### HTTP request headers @@ -524,6 +545,9 @@ $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->se // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); +// Configure Bearer (JWT) authorization: bearer +$config = Verdigado\GrueneApiClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + $apiInstance = new Verdigado\GrueneApiClient\Api\ProfilesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. @@ -555,7 +579,7 @@ try { ### Authorization -[api_key](../../README.md#api_key) +[api_key](../../README.md#api_key), [bearer](../../README.md#bearer) ### HTTP request headers diff --git a/docs/Api/UsersApi.md b/docs/Api/UsersApi.md index 08a5cef..38a9c47 100644 --- a/docs/Api/UsersApi.md +++ b/docs/Api/UsersApi.md @@ -1,6 +1,6 @@ # Verdigado\GrueneApiClient\UsersApi -All URIs are relative to http://127.0.0.1:5000, except if the operation defines another base path. +All URIs are relative to http://0.0.0.0:5000, except if the operation defines another base path. | Method | HTTP request | Description | | ------------- | ------------- | ------------- | diff --git a/lib/Configuration.php b/lib/Configuration.php index a373e9e..616a848 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -93,14 +93,14 @@ class Configuration * * @var string */ - protected $host = 'http://127.0.0.1:5000'; + protected $host = 'http://0.0.0.0:5000'; /** * User agent of the HTTP request, set to "OpenAPI-Generator/{version}/PHP" by default * * @var string */ - protected $userAgent = 'OpenAPI-Generator/0.4.0/PHP'; + protected $userAgent = 'OpenAPI-Generator/0.5.0/PHP'; /** * Debug switch (default set to false) @@ -433,7 +433,7 @@ public static function toDebugReport() $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' The version of the OpenAPI document: 0.1.0' . PHP_EOL; - $report .= ' SDK Package Version: 0.4.0' . PHP_EOL; + $report .= ' SDK Package Version: 0.5.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; @@ -473,7 +473,7 @@ public function getHostSettings() { return [ [ - "url" => "http://127.0.0.1:5000", + "url" => "http://0.0.0.0:5000", "description" => "localhost", ], [ diff --git a/lib/apis/ProfilesApi.php b/lib/apis/ProfilesApi.php index 95a66aa..cb90039 100644 --- a/lib/apis/ProfilesApi.php +++ b/lib/apis/ProfilesApi.php @@ -412,6 +412,10 @@ public function createProfileRequest($create_profile, string $contentType = self if ($apiKey !== null) { $headers['x-api-key'] = $apiKey; } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -646,6 +650,10 @@ public function deleteProfileRequest($profile_id, string $contentType = self::co if ($apiKey !== null) { $headers['x-api-key'] = $apiKey; } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -880,6 +888,10 @@ public function deleteProfileImageRequest($profile_id, string $contentType = sel if ($apiKey !== null) { $headers['x-api-key'] = $apiKey; } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -1516,6 +1528,10 @@ public function findProfilesRequest($tags = null, $search = null, string $conten if ($apiKey !== null) { $headers['x-api-key'] = $apiKey; } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -1784,6 +1800,10 @@ public function getOwnProfileRequest(string $contentType = self::contentTypes['g if ($apiKey !== null) { $headers['x-api-key'] = $apiKey; } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -2072,6 +2092,10 @@ public function getProfileRequest($profile_id, string $contentType = self::conte if ($apiKey !== null) { $headers['x-api-key'] = $apiKey; } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -2325,6 +2349,10 @@ public function updateProfileRequest($profile_id, $update_profile, string $conte if ($apiKey !== null) { $headers['x-api-key'] = $apiKey; } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } $defaultHeaders = []; if ($this->config->getUserAgent()) { @@ -2629,6 +2657,10 @@ public function updateProfileImageRequest($profile_id, $profile_image, string $c if ($apiKey !== null) { $headers['x-api-key'] = $apiKey; } + // this endpoint requires Bearer (JWT) authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } $defaultHeaders = []; if ($this->config->getUserAgent()) {