diff --git a/src/OpenRoamin_GlobalReach.cpp b/src/OpenRoamin_GlobalReach.cpp index dec7528..690eb7a 100644 --- a/src/OpenRoamin_GlobalReach.cpp +++ b/src/OpenRoamin_GlobalReach.cpp @@ -51,36 +51,26 @@ namespace OpenWifi { auto BearerToken = MakeToken(GlobalReachAccountId); Poco::URI URI{"https://config.openro.am/v1/radsec/issue"}; std::string Path(URI.getPathAndQuery()); - std::cout << __LINE__ << std::endl; Poco::Net::HTTPRequest Request(Poco::Net::HTTPRequest::HTTP_POST, Path, Poco::Net::HTTPMessage::HTTP_1_1); - std::cout << __LINE__ << std::endl; - Request.add("Authorization", "Bearer " + BearerToken); - std::cout << __LINE__ << std::endl; Poco::Net::HTTPSClientSession Session(URI.getHost(), URI.getPort()); Session.setTimeout(Poco::Timespan(10000, 10000)); - std::cout << __LINE__ << std::endl; Poco::JSON::Object CertRequestBody; CertRequestBody.set("name", Name); CertRequestBody.set("csr", CSR); - std::cout << __LINE__ << std::endl; std::ostringstream os; - std::cout << __LINE__ << std::endl; CertRequestBody.stringify(os); Request.setContentType("application/json"); Request.setContentLength((long) os.str().size()); - std::cout << __LINE__ << std::endl; auto &Body = Session.sendRequest(Request); Body << os.str(); - std::cout << __LINE__ << std::endl; Poco::Net::HTTPResponse Response; std::istream &is = Session.receiveResponse(Response); - std::cout << __LINE__ << std::endl; if (Response.getStatus() == Poco::Net::HTTPResponse::HTTP_OK) { Poco::JSON::Parser P; auto Result = P.parse(is).extract(); @@ -90,7 +80,6 @@ namespace OpenWifi { NewCertificate.certificateChain = Result->get("certificate_chain").toString(); NewCertificate.certificateId = Result->get("certificate_id").toString(); NewCertificate.expiresAt = Result->get("expires_at"); - std::cout << __LINE__ << std::endl; return true; } Poco::JSON::Parser P; @@ -108,6 +97,7 @@ namespace OpenWifi { const std::string &GlobalReachAccountId, std::string &CertificateId, ProvObjects::GLBLRCertificateInfo &NewCertificate) { + std::cout << __LINE__ << ":" << GlobalReachAccountId << std::endl; try { Poco::URI URI{fmt::format("https://config.openro.am/v1/radsec/cert/{}", CertificateId)}; @@ -153,6 +143,7 @@ namespace OpenWifi { token.setType("JWT"); token.setAlgorithm("ES256"); token.setIssuedAt(std::time(nullptr)); + std::cout << __LINE__ << ":" << GlobalReachAccountId << std::endl; token.payload().set("iss", GlobalReachAccountId); token.payload().set("iat", (unsigned long) std::time(nullptr)); @@ -160,13 +151,10 @@ namespace OpenWifi { Poco::SharedPtr Key; auto KeyHash = Utils::ComputeHash(PrivateKey); auto KeyHint = PrivateKeys_.find(GlobalReachAccountId); - DBGLINE if (KeyHint != PrivateKeys_.end() && KeyHint->second.first == KeyHash) { - DBGLINE Key = KeyHint->second.second; } else { if (PrivateKey.empty()) { - DBGLINE return ""; } Poco::TemporaryFile F; @@ -177,7 +165,6 @@ namespace OpenWifi { new Poco::Crypto::ECKey("", F.path(), "")); Key = NewKey; PrivateKeys_[GlobalReachAccountId] = std::make_pair(KeyHash, NewKey); - DBGLINE } Poco::JWT::Signer Signer;