mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-01 19:17:47 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -34,14 +34,14 @@ namespace OpenWifi {
|
|||||||
if(GetBoolParameter("updateEndpoints")) {
|
if(GetBoolParameter("updateEndpoints")) {
|
||||||
RadiusEndpointUpdater R;
|
RadiusEndpointUpdater R;
|
||||||
|
|
||||||
std::string Error;
|
std::uint64_t ErrorCode;
|
||||||
uint64_t ErrorNum = 0;
|
std::string ErrorDetails;
|
||||||
R.UpdateEndpoints(this, Error, ErrorNum);
|
std::string ErrorDescription;
|
||||||
|
|
||||||
Poco::JSON::Object Answer;
|
if(!R.UpdateEndpoints(this, ErrorCode, ErrorDetails,ErrorDescription)) {
|
||||||
Answer.set("Error", Error);
|
return InternalError(RESTAPI::Errors::msg{.err_num = ErrorCode, .err_txt = ErrorDetails + ":" + ErrorDescription});
|
||||||
Answer.set("ErrorNum", ErrorNum);
|
}
|
||||||
return ReturnObject(Answer);
|
return OK();
|
||||||
}
|
}
|
||||||
return BadRequest(RESTAPI::Errors::MissingAuthenticationInformation);
|
return BadRequest(RESTAPI::Errors::MissingAuthenticationInformation);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ namespace OpenWifi {
|
|||||||
bool InCert = false;
|
bool InCert = false;
|
||||||
std::string Line;
|
std::string Line;
|
||||||
while(std::getline(os,Line)) {
|
while(std::getline(os,Line)) {
|
||||||
std::cout << Line << std::endl;
|
|
||||||
if(Line=="-----BEGIN CERTIFICATE-----") {
|
if(Line=="-----BEGIN CERTIFICATE-----") {
|
||||||
InCert = true;
|
InCert = true;
|
||||||
CurrentCert += Line;
|
CurrentCert += Line;
|
||||||
@@ -40,11 +39,11 @@ namespace OpenWifi {
|
|||||||
CurrentCert += "\n";
|
CurrentCert += "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool UpdateEndpoints( RESTAPIHandler *Client, [[maybe_unused]] std::string & Error,
|
inline bool UpdateEndpoints( RESTAPIHandler *Client, std::uint64_t & ErrorCode,
|
||||||
[[maybe_unused]] uint64_t &ErrorNum ) {
|
std::string & ErrorDetails,
|
||||||
|
std::string & ErrorDescription) {
|
||||||
|
|
||||||
std::vector<ProvObjects::RADIUSEndPoint> Endpoints;
|
std::vector<ProvObjects::RADIUSEndPoint> Endpoints;
|
||||||
GWObjects::RadiusProxyPoolList Pools;
|
GWObjects::RadiusProxyPoolList Pools;
|
||||||
@@ -78,7 +77,6 @@ namespace OpenWifi {
|
|||||||
for(const auto &cert:OA.cacerts) {
|
for(const auto &cert:OA.cacerts) {
|
||||||
auto C = Utils::base64encode((const u_char *)cert.c_str(),cert.size());
|
auto C = Utils::base64encode((const u_char *)cert.c_str(),cert.size());
|
||||||
PE.radsecCacerts.emplace_back(C);
|
PE.radsecCacerts.emplace_back(C);
|
||||||
std::cout << C << std::endl;
|
|
||||||
}
|
}
|
||||||
PE.radsec = true;
|
PE.radsec = true;
|
||||||
PE.name = fmt::format("Server {}",i++);
|
PE.name = fmt::format("Server {}",i++);
|
||||||
@@ -190,18 +188,23 @@ namespace OpenWifi {
|
|||||||
GWObjects::RadiusProxyPoolList NewPools;
|
GWObjects::RadiusProxyPoolList NewPools;
|
||||||
Poco::JSON::Object ErrorObj;
|
Poco::JSON::Object ErrorObj;
|
||||||
if(SDK::GW::RADIUS::SetConfiguration(Client, Pools, NewPools, ErrorObj)) {
|
if(SDK::GW::RADIUS::SetConfiguration(Client, Pools, NewPools, ErrorObj)) {
|
||||||
DBGLINE
|
|
||||||
AppServiceRegistry().Set("radiusEndpointLastUpdate", Utils::Now());
|
AppServiceRegistry().Set("radiusEndpointLastUpdate", Utils::Now());
|
||||||
DBGLINE
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
DBGLINE
|
ErrorCode:
|
||||||
Error = "Could not update the controller.";
|
type: integer
|
||||||
ErrorNum = 1;
|
ErrorDetails:
|
||||||
|
type: string
|
||||||
DBGLINE
|
ErrorDescription:
|
||||||
|
type: string
|
||||||
|
*/
|
||||||
|
if(ErrorObj.has("ErrorCode") && !ErrorObj.isNull("ErrorCode"))
|
||||||
|
ErrorCode = ErrorObj.get("ErrorCode");
|
||||||
|
if(ErrorObj.has("ErrorDescription") && !ErrorObj.isNull("ErrorDescription"))
|
||||||
|
ErrorDescription = ErrorObj.get("ErrorDescription").toString();
|
||||||
|
if(ErrorObj.has("ErrorDetails") && !ErrorObj.isNull("ErrorDetails"))
|
||||||
|
ErrorDetails += ErrorObj.get("ErrorDetails").toString();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user