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