-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <[email protected]>
- Loading branch information
1 parent
b950694
commit 5cc00a2
Showing
16 changed files
with
596 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4 | ||
12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// | ||
// Created by stephane bourque on 2023-09-11. | ||
// | ||
|
||
#include "OpenRoamin_GlobalReach.h" | ||
|
||
namespace OpenWifi { | ||
|
||
int OpenRoaming_GlobalReach::Start() { | ||
poco_information(Logger(), "Starting..."); | ||
return 0; | ||
} | ||
|
||
void OpenRoaming_GlobalReach::Stop() { | ||
poco_information(Logger(), "Stopping..."); | ||
poco_information(Logger(), "Stopped..."); | ||
} | ||
|
||
bool OpenRoaming_GlobalReach::GetAccountInfo(const std::string &AccountName, ProvObjects::GLBLRAccountInfo &Account) { | ||
/* Poco::URI URI{"https://config.openro.am/v1/config"}; | ||
std::string Path(URI.getPathAndQuery()); | ||
Poco::Net::HTTPRequest Request(Poco::Net::HTTPRequest::HTTP_GET, Path, | ||
Poco::Net::HTTPMessage::HTTP_1_1); | ||
Request.add("Authorization", "Bearer " + BearerToken); | ||
Poco::Net::HTTPSClientSession Session(URI.getHost(), URI.getPort()); | ||
Session.setTimeout(Poco::Timespan(10000, 10000)); | ||
Session.sendRequest(Request); | ||
Poco::Net::HTTPResponse Response; | ||
std::istream &is = Session.receiveResponse(Response); | ||
Poco::JSON::Parser P; | ||
Result= P.parse(is).extract<Poco::JSON::Object::Ptr>(); | ||
std::cout << Response.getStatus() << " : " ; | ||
Result->stringify(std::cout); | ||
std::cout << std::endl; | ||
*/ | ||
return true; | ||
} | ||
|
||
bool OpenRoaming_GlobalReach::CreateRadsecCertificate(const std::string &AccountName, ProvObjects::GLBLRCertificateInfo &NewCertificate) { | ||
/* | ||
Poco::URI URI{"https://config.openro.am/v1/radsec/issue"}; | ||
std::string Path(URI.getPathAndQuery()); | ||
Poco::Net::HTTPRequest Request(Poco::Net::HTTPRequest::HTTP_POST, Path, | ||
Poco::Net::HTTPMessage::HTTP_1_1); | ||
Request.add("Authorization", "Bearer " + BearerToken); | ||
Poco::Net::HTTPSClientSession Session(URI.getHost(), URI.getPort()); | ||
Session.setTimeout(Poco::Timespan(10000, 10000)); | ||
std::ostringstream os; | ||
Body.stringify(os); | ||
Request.setContentType("application/json"); | ||
Request.setContentLength(os.str().size()); | ||
auto &body = Session.sendRequest(Request); | ||
body << os.str(); | ||
Poco::Net::HTTPResponse Response; | ||
std::istream &is = Session.receiveResponse(Response); | ||
Poco::JSON::Parser P; | ||
Result= P.parse(is).extract<Poco::JSON::Object::Ptr>(); | ||
std::cout << Response.getStatus() << " : " ; | ||
Result->stringify(std::cout); | ||
std::cout << std::endl; | ||
*/ | ||
return true; | ||
} | ||
|
||
bool OpenRoaming_GlobalReach::GetRadsecCertificate(const std::string &AccountName, std::string &CertificateId, | ||
ProvObjects::GLBLRCertificateInfo &NewCertificate) { | ||
return true; | ||
} | ||
|
||
} // OpenWifi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// Created by stephane bourque on 2023-09-11. | ||
// | ||
|
||
#pragma once | ||
|
||
#include "framework/SubSystemServer.h" | ||
#include "Poco/JSON/Object.h" | ||
#include "RESTObjects/RESTAPI_ProvObjects.h" | ||
|
||
namespace OpenWifi { | ||
|
||
class OpenRoaming_GlobalReach : public SubSystemServer { | ||
public: | ||
static auto instance() { | ||
static auto instance_ = new OpenRoaming_GlobalReach; | ||
return instance_; | ||
} | ||
|
||
int Start() override; | ||
void Stop() override; | ||
bool GetAccountInfo(const std::string &AccountName, ProvObjects::GLBLRAccountInfo &Account); | ||
bool CreateRadsecCertificate(const std::string &AccountName, ProvObjects::GLBLRCertificateInfo &NewCertificate); | ||
bool GetRadsecCertificate(const std::string &AccountName, std::string & CertificateId, ProvObjects::GLBLRCertificateInfo &NewCertificate); | ||
|
||
private: | ||
std::string CreateJWTToken(const std::string &AccountName); | ||
|
||
OpenRoaming_GlobalReach() noexcept | ||
: SubSystemServer("OpenRoaming_GlobalReach", "GLBL-REACH", "globalreach") { | ||
} | ||
}; | ||
|
||
inline auto OpenRoaming_GlobalReach() { return OpenRoaming_GlobalReach::instance(); } | ||
|
||
} // OpenWifi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.