diff --git a/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/README.md b/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/README.md index 5a6b0ee..f6b2b0c 100644 --- a/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/README.md +++ b/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/README.md @@ -100,6 +100,7 @@ Class | Method | HTTP request | Description *SessionApi* | [**initLogin**](docs/Api/SessionApi.md#initlogin) | **GET** /session/{Email}/{Mode} | InitLogin *SessionApi* | [**login**](docs/Api/SessionApi.md#login) | **POST** /session/{Email}/{Mode} | Login *SessionApi* | [**loginMFA**](docs/Api/SessionApi.md#loginmfa) | **PUT** /session/{Email}/{Mode}/mfacode | LoginMFA +*SessionApi* | [**logout**](docs/Api/SessionApi.md#logout) | **DELETE** /session/{Email}/{Mode} | Logout ## Documentation For Models diff --git a/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/docs/Api/SessionApi.md b/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/docs/Api/SessionApi.md index 23343b3..9df6111 100644 --- a/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/docs/Api/SessionApi.md +++ b/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/docs/Api/SessionApi.md @@ -7,6 +7,7 @@ Method | HTTP request | Description [**initLogin**](SessionApi.md#initLogin) | **GET** /session/{Email}/{Mode} | InitLogin [**login**](SessionApi.md#login) | **POST** /session/{Email}/{Mode} | Login [**loginMFA**](SessionApi.md#loginMFA) | **PUT** /session/{Email}/{Mode}/mfacode | LoginMFA +[**logout**](SessionApi.md#logout) | **DELETE** /session/{Email}/{Mode} | Logout # **initLogin** @@ -154,3 +155,61 @@ No authorization required [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) +# **logout** +> \Swagger\Client\Model\Response logout($authorization, $email, $mode) + +Logout + +Logout invalidates _IdToken_. + +### Example +```php +setApiKey('Authorization', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer'); +// Configure API key authorization: X-Api-Key +Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); + +$api_instance = new Swagger\Client\Api\SessionApi(); +$authorization = "authorization_example"; // string | Use _IdToken_ from the Login response as the Authorization header +$email = "email_example"; // string | Email address as the account username, e.g. `dan.forsberg@isecure.fi` +$mode = "mode_example"; // string | Administer account with `admin` mode, exchange files with `data` mode + +try { + $result = $api_instance->logout($authorization, $email, $mode); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SessionApi->logout: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **string**| Use _IdToken_ from the Login response as the Authorization header | + **email** | **string**| Email address as the account username, e.g. `dan.forsberg@isecure.fi` | + **mode** | **string**| Administer account with `admin` mode, exchange files with `data` mode | + +### Return type + +[**\Swagger\Client\Model\Response**](../Model/Response.md) + +### Authorization + +[Authorizer](../../README.md#Authorizer), [X-Api-Key](../../README.md#X-Api-Key) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/lib/Api/SessionApi.php b/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/lib/Api/SessionApi.php index 1178a19..46f8a36 100644 --- a/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/lib/Api/SessionApi.php +++ b/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/lib/Api/SessionApi.php @@ -429,4 +429,139 @@ public function loginMFAWithHttpInfo($login_mfa_req, $email, $mode) throw $e; } } + + /** + * Operation logout + * + * Logout + * + * @param string $authorization Use _IdToken_ from the Login response as the Authorization header (required) + * @param string $email Email address as the account username, e.g. `dan.forsberg@isecure.fi` (required) + * @param string $mode Administer account with `admin` mode, exchange files with `data` mode (required) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\Response + */ + public function logout($authorization, $email, $mode) + { + list($response) = $this->logoutWithHttpInfo($authorization, $email, $mode); + return $response; + } + + /** + * Operation logoutWithHttpInfo + * + * Logout + * + * @param string $authorization Use _IdToken_ from the Login response as the Authorization header (required) + * @param string $email Email address as the account username, e.g. `dan.forsberg@isecure.fi` (required) + * @param string $mode Administer account with `admin` mode, exchange files with `data` mode (required) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\Response, HTTP status code, HTTP response headers (array of strings) + */ + public function logoutWithHttpInfo($authorization, $email, $mode) + { + // verify the required parameter 'authorization' is set + if ($authorization === null) { + throw new \InvalidArgumentException('Missing the required parameter $authorization when calling logout'); + } + // verify the required parameter 'email' is set + if ($email === null) { + throw new \InvalidArgumentException('Missing the required parameter $email when calling logout'); + } + // verify the required parameter 'mode' is set + if ($mode === null) { + throw new \InvalidArgumentException('Missing the required parameter $mode when calling logout'); + } + // parse inputs + $resourcePath = "/session/{Email}/{Mode}"; + $httpBody = ''; + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + + // header params + if ($authorization !== null) { + $headerParams['Authorization'] = $this->apiClient->getSerializer()->toHeaderValue($authorization); + } + // path params + if ($email !== null) { + $resourcePath = str_replace( + "{" . "Email" . "}", + $this->apiClient->getSerializer()->toPathValue($email), + $resourcePath + ); + } + // path params + if ($mode !== null) { + $resourcePath = str_replace( + "{" . "Mode" . "}", + $this->apiClient->getSerializer()->toPathValue($mode), + $resourcePath + ); + } + // default format to json + $resourcePath = str_replace("{format}", "json", $resourcePath); + + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + // this endpoint requires API key authentication + $apiKey = $this->apiClient->getApiKeyWithPrefix('Authorization'); + if (strlen($apiKey) !== 0) { + $headerParams['Authorization'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->apiClient->getApiKeyWithPrefix('x-api-key'); + if (strlen($apiKey) !== 0) { + $headerParams['x-api-key'] = $apiKey; + } + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, + 'DELETE', + $queryParams, + $httpBody, + $headerParams, + '\Swagger\Client\Model\Response', + '/session/{Email}/{Mode}' + ); + + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Response', $httpHeader), $statusCode, $httpHeader]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Response', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + case 400: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Error', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + case 401: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Error', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + case 403: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Error', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + case 500: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Error', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + } + + throw $e; + } + } } diff --git a/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/test/Api/SessionApiTest.php b/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/test/Api/SessionApiTest.php index 69b0d35..19b01c7 100644 --- a/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/test/Api/SessionApiTest.php +++ b/wscli-php-sdk/swagger-php-sdk/SwaggerClient-php/test/Api/SessionApiTest.php @@ -109,4 +109,15 @@ public function testLoginMFA() } + /** + * Test case for logout + * + * Logout. + * + */ + public function testLogout() + { + + } + }