Files
openapi-generator/samples/server/petstore/cpp-pistache-everything/impl/StoreApiImpl.cpp
KRJ-RTX 18b359ba17 Add Basic and Bearer Authorization to the CPP Pistache generator (#22337)
* [cpp][pistache-server] Add extraction and forwarding of credentials for HTTP Basic protected endpoints.

* [cpp][pistache-server] Change HTTP Basic credentials to be contained on a struct instead of two std::strings

* [cpp][pistache-server] Add callbacks to authenticate http basic credentials.

* [cpp][pistache-server] Add `void* userdata` to HttpBasicCredentials.

This allows for data ft be passed on from the authenticator to the
handler implementation. For example a userid that has already been
looked up

* [cpp][pistache-server] Add support for HTTP Bearer authentication.

* [cpp][pistache-server] Add new file `api-base-source.mustache`

`api-base-source.mustache` contain implementations of security
related methods and also the empty constructor.

* [cpp][pistache-server] Add re-generated samples.

* Fix PR 19978: Updated indentation levels and fixed test problems

---------

Co-authored-by: Morten Winkler <morten@winkler.dk>
2025-12-02 10:07:47 +08:00

50 lines
1.3 KiB
C++

/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "StoreApiImpl.h"
namespace org {
namespace openapitools {
namespace server {
namespace api {
using namespace org::openapitools::server::model;
StoreApiImpl::StoreApiImpl(const std::shared_ptr<Pistache::Rest::Router>& rtr)
: StoreApi(rtr)
{
}
void StoreApiImpl::delete_order(const std::string &orderId, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
void StoreApiImpl::get_inventory(Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
void StoreApiImpl::get_order_by_id(const int64_t &orderId, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
void StoreApiImpl::place_order(const Order &order, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
}
}
}
}