diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b813be..ec1cc74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,7 +209,7 @@ add_executable(owprov src/ProvWebSocketClient.cpp src/ProvWebSocketClient.h src/Tasks/VenueRebooter.h src/Tasks/VenueUpgrade.h src/sdks/SDK_fms.cpp src/sdks/SDK_fms.h - src/RESTAPI/RESTAPI_overrides_handler.cpp src/RESTAPI/RESTAPI_overrides_handler.h src/OpenRoamin_GlobalReach.cpp src/OpenRoamin_GlobalReach.h src/storage/storage_glblraccounts.cpp src/storage/storage_glblraccounts.h src/storage/storage_glblrcerts.cpp src/storage/storage_glblrcerts.h src/RESTAPI/RESTAPI_openroaming_gr_list_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_list_acct_handler.h src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.h src/RESTAPI/RESTAPI_openroaming_gr_list_certificates.cpp src/RESTAPI/RESTAPI_openroaming_gr_list_certificates.h src/RESTAPI/RESTAPI_openroaming_gr_cert_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_cert_handler.h) + src/RESTAPI/RESTAPI_overrides_handler.cpp src/RESTAPI/RESTAPI_overrides_handler.h src/OpenRoamin_GlobalReach.cpp src/OpenRoamin_GlobalReach.h src/storage/storage_glblraccounts.cpp src/storage/storage_glblraccounts.h src/storage/storage_glblrcerts.cpp src/storage/storage_glblrcerts.h src/RESTAPI/RESTAPI_openroaming_gr_list_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_list_acct_handler.h src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.h src/RESTAPI/RESTAPI_openroaming_gr_list_certificates.cpp src/RESTAPI/RESTAPI_openroaming_gr_list_certificates.h src/RESTAPI/RESTAPI_openroaming_gr_cert_handler.cpp src/RESTAPI/RESTAPI_openroaming_gr_cert_handler.h src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.h src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.cpp src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.h) target_link_libraries(owprov PUBLIC ${Poco_LIBRARIES} diff --git a/build b/build index 2edeafb..cabf43b 100644 --- a/build +++ b/build @@ -1 +1 @@ -20 \ No newline at end of file +24 \ No newline at end of file diff --git a/openapi/openroaming_globalreach.yaml b/openapi/openroaming_globalreach.yaml index 8627d56..2a91951 100644 --- a/openapi/openroaming_globalreach.yaml +++ b/openapi/openroaming_globalreach.yaml @@ -1,7 +1,7 @@ openapi: 3.0.1 info: - title: OpenWiFi Provisioning Model - description: Definitions and APIs to manages an OpenWiFi network. + title: OpenWiFi OpenRoaming Provisioning Model for Global Reach + description: Definitions and APIs to Open Roaming WiFi. version: 2.5.0 license: name: BSD3 diff --git a/openapi/openroaming_orion.yaml b/openapi/openroaming_orion.yaml new file mode 100644 index 0000000..847bf7e --- /dev/null +++ b/openapi/openroaming_orion.yaml @@ -0,0 +1,195 @@ +openapi: 3.0.1 +info: + title: OpenWiFi OpenRoaming Provisioning Model for Google Orion + description: Definitions and APIs to Open Roaming WiFi. + version: 2.5.0 + license: + name: BSD3 + url: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE + +servers: + - url: 'https://localhost:16005/api/v1' + +security: + - bearerAuth: [] + - ApiKeyAuth: [] + +components: + securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: X-API-KEY + bearerAuth: + type: http + scheme: bearer + bearerFormat: JWT + + responses: + NotFound: + $ref: 'https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/blob/main/openpapi/owsec.yaml#/components/responses/NotFound' + Unauthorized: + $ref: 'https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/blob/main/openpapi/owsec.yaml#/components/responses/Unauthorized' + Success: + $ref: 'https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/blob/main/openpapi/owsec.yaml#/components/responses/Success' + BadRequest: + $ref: 'https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/blob/main/openpapi/owsec.yaml#/components/responses/BadRequest' + + schemas: + GooglOrionAccountInfo: + type: object + properties: + allOf: + $ref: 'https://github.com/Telecominfraproject/wlan-cloud-owprov/blob/main/openpapi/owprov.yaml#/components/schemas/ObjectInfo' + privateKey: + type: string + certificate: + type: string + cacerts: + type: array + items: + type: string + +paths: + /openroaming/orion/accounts: + get: + tags: + - OpenRoaming-Google Orion + operationId: getOpenRoamingGlobalReachAccountList + summary: Retrieve account list. + parameters: + - in: query + description: Pagination start (starts at 1. If not specified, 1 is assumed) + name: offset + schema: + type: integer + required: false + - in: query + description: Maximum number of entries to return (if absent, no limit is assumed) + name: limit + schema: + type: integer + required: false + - in: query + description: return the number of accounts + name: countOnly + schema: + type: boolean + required: false + + responses: + 200: + description: The list of accounts + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/GooglOrionAccountInfo' + $ref: '#/components/responses/Success' + 400: + $ref: '#/components/responses/BadRequest' + 403: + $ref: '#/components/responses/Unauthorized' + 404: + $ref: '#/components/responses/NotFound' + + /openroaming/globalreach/account/{name}: + get: + tags: + - OpenRoaming-Google Orion + operationId: getOpenRoamingGlobalReachAccount + summary: Retrieve account information. + parameters: + - in: path + description: The account name + name: name + schema: + type: string + required: true + responses: + 200: + $ref: '#/components/schemas/GooglOrionAccountInfo' + 400: + $ref: '#/components/responses/BadRequest' + 403: + $ref: '#/components/responses/Unauthorized' + 404: + $ref: '#/components/responses/NotFound' + + delete: + tags: + - OpenRoaming-Google Orion + operationId: deleteOpenRoamingGlobalReachAccount + summary: Delete account information. + parameters: + - in: path + description: The account name + name: name + schema: + type: string + required: true + responses: + 200: + $ref: '#/components/responses/Success' + 400: + $ref: '#/components/responses/BadRequest' + 403: + $ref: '#/components/responses/Unauthorized' + 404: + $ref: '#/components/responses/NotFound' + + post: + tags: + - OpenRoaming-Google Orion + operationId: createOpenRoamingGlobalReachAccount + summary: Create account information. + parameters: + - in: path + description: The account name + name: name + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GooglOrionAccountInfo' + responses: + 200: + $ref: '#/components/schemas/GooglOrionAccountInfo' + 400: + $ref: '#/components/responses/BadRequest' + 403: + $ref: '#/components/responses/Unauthorized' + 404: + $ref: '#/components/responses/NotFound' + + put: + tags: + - OpenRoaming-Google Orion + operationId: modifyOpenRoamingGlobalReachAccount + summary: Modify account information. + parameters: + - in: path + description: The account name + name: name + schema: + type: string + required: true + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GooglOrionAccountInfo' + responses: + 200: + $ref: '#/components/schemas/GooglOrionAccountInfo' + 400: + $ref: '#/components/responses/BadRequest' + 403: + $ref: '#/components/responses/Unauthorized' + 404: + $ref: '#/components/responses/NotFound' + diff --git a/src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.cpp b/src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.cpp new file mode 100644 index 0000000..7150e06 --- /dev/null +++ b/src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.cpp @@ -0,0 +1,8 @@ +// +// Created by stephane bourque on 2023-09-15. +// + +#include "RESTAPI_openroaming_orion_acct_handler.h" + +namespace OpenWifi { +} // OpenWifi \ No newline at end of file diff --git a/src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.h b/src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.h new file mode 100644 index 0000000..ebdb31d --- /dev/null +++ b/src/RESTAPI/RESTAPI_openroaming_orion_acct_handler.h @@ -0,0 +1,16 @@ +// +// Created by stephane bourque on 2023-09-15. +// + +#ifndef OWPROV_RESTAPI_OPENROAMING_ORION_ACCT_HANDLER_H +#define OWPROV_RESTAPI_OPENROAMING_ORION_ACCT_HANDLER_H + +namespace OpenWifi { + + class RESTAPI_openroaming_orion_acct_handler { + + }; + +} // OpenWifi + +#endif //OWPROV_RESTAPI_OPENROAMING_ORION_ACCT_HANDLER_H diff --git a/src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.cpp b/src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.cpp new file mode 100644 index 0000000..e15682d --- /dev/null +++ b/src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.cpp @@ -0,0 +1,8 @@ +// +// Created by stephane bourque on 2023-09-15. +// + +#include "RESTAPI_openroaming_orion_list_acct_handler.h" + +namespace OpenWifi { +} // OpenWifi \ No newline at end of file diff --git a/src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.h b/src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.h new file mode 100644 index 0000000..99b7f5c --- /dev/null +++ b/src/RESTAPI/RESTAPI_openroaming_orion_list_acct_handler.h @@ -0,0 +1,16 @@ +// +// Created by stephane bourque on 2023-09-15. +// + +#ifndef OWPROV_RESTAPI_OPENROAMING_ORION_LIST_ACCT_HANDLER_H +#define OWPROV_RESTAPI_OPENROAMING_ORION_LIST_ACCT_HANDLER_H + +namespace OpenWifi { + + class RESTAPI_openroaming_orion_list_acct_handler { + + }; + +} // OpenWifi + +#endif //OWPROV_RESTAPI_OPENROAMING_ORION_LIST_ACCT_HANDLER_H diff --git a/src/RESTObjects/RESTAPI_ProvObjects.cpp b/src/RESTObjects/RESTAPI_ProvObjects.cpp index cf88234..c2166eb 100644 --- a/src/RESTObjects/RESTAPI_ProvObjects.cpp +++ b/src/RESTObjects/RESTAPI_ProvObjects.cpp @@ -1258,4 +1258,25 @@ namespace OpenWifi::ProvObjects { return false; } + void GooglOrionAccountInfo::to_json(Poco::JSON::Object &Obj) const { + info.to_json(Obj); + field_to_json(Obj, "privateKey", privateKey); + field_to_json(Obj, "certificate", certificate); + field_to_json(Obj, "cacerts", cacerts); + } + + bool GooglOrionAccountInfo::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + info.from_json(Obj); + field_from_json(Obj, "privateKey", privateKey); + field_from_json(Obj, "certificate", certificate); + field_from_json(Obj, "cacerts", cacerts); + return true; + } catch (const Poco::Exception &E) { + + } + return false; + } + + } // namespace OpenWifi::ProvObjects diff --git a/src/RESTObjects/RESTAPI_ProvObjects.h b/src/RESTObjects/RESTAPI_ProvObjects.h index ec8f449..725b9cc 100644 --- a/src/RESTObjects/RESTAPI_ProvObjects.h +++ b/src/RESTObjects/RESTAPI_ProvObjects.h @@ -773,4 +773,14 @@ namespace OpenWifi::ProvObjects { bool from_json(const Poco::JSON::Object::Ptr &Obj); }; + struct GooglOrionAccountInfo { + ObjectInfo info; + std::string privateKey; + std::string certificate; + std::vector cacerts; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + }; // namespace OpenWifi::ProvObjects