mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-10-30 18:27:49 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -9,8 +9,8 @@ RUN apk add --update --no-cache \
|
|||||||
|
|
||||||
FROM build-base AS poco-build
|
FROM build-base AS poco-build
|
||||||
|
|
||||||
ADD https://api.github.com/repos/stephb9959/poco/git/refs/heads/master version.json
|
ADD https://api.github.com/repos/AriliaWireless/poco/git/refs/tags/poco-tip-v1 version.json
|
||||||
RUN git clone https://github.com/stephb9959/poco /poco
|
RUN git clone https://github.com/AriliaWireless/poco --branch poco-tip-v1 /poco
|
||||||
|
|
||||||
WORKDIR /poco
|
WORKDIR /poco
|
||||||
RUN mkdir cmake-build
|
RUN mkdir cmake-build
|
||||||
|
|||||||
@@ -703,6 +703,19 @@ namespace OpenWifi::Utils {
|
|||||||
return (std::all_of(UUID.begin(),UUID.end(),[&](auto i){ if(i=='-') dashes++; return i=='-' || std::isxdigit(i);})) && (dashes>0);
|
return (std::all_of(UUID.begin(),UUID.end(),[&](auto i){ if(i=='-') dashes++; return i=='-' || std::isxdigit(i);})) && (dashes>0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename ...Args> std::string ComputeHash(Args&&... args) {
|
||||||
|
Poco::SHA2Engine E;
|
||||||
|
auto as_string = [](auto p) {
|
||||||
|
if constexpr(std::is_arithmetic_v<decltype(p)>) {
|
||||||
|
return std::to_string(p);
|
||||||
|
} else {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
(E.update(as_string(args)),...);
|
||||||
|
return Poco::SHA2Engine::digestToHex(E.digest());
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] inline std::vector<std::string> Split(const std::string &List, char Delimiter=',' ) {
|
[[nodiscard]] inline std::vector<std::string> Split(const std::string &List, char Delimiter=',' ) {
|
||||||
std::vector<std::string> ReturnList;
|
std::vector<std::string> ReturnList;
|
||||||
|
|
||||||
@@ -2736,12 +2749,12 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::recursive_mutex Mutex_;
|
std::recursive_mutex Mutex_;
|
||||||
Types::NotifyTable Notifiers_;
|
Types::NotifyTable Notifiers_;
|
||||||
Poco::Thread Worker_;
|
Poco::Thread Worker_;
|
||||||
mutable std::atomic_bool Running_=false;
|
mutable std::atomic_bool Running_=false;
|
||||||
uint64_t FunctionId_=1;
|
uint64_t FunctionId_=1;
|
||||||
Poco::NotificationQueue Queue_;
|
Poco::NotificationQueue Queue_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KafkaManager : public SubSystemServer {
|
class KafkaManager : public SubSystemServer {
|
||||||
@@ -3023,7 +3036,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
int Start() override;
|
int Start() override;
|
||||||
inline void Stop() override {
|
inline void Stop() override {
|
||||||
Logger().information("Stopping ");
|
Logger().information("Stopping...");
|
||||||
for( const auto & svr : RESTServers_ )
|
for( const auto & svr : RESTServers_ )
|
||||||
svr->stop();
|
svr->stop();
|
||||||
Pool_.stopAll();
|
Pool_.stopAll();
|
||||||
@@ -3156,7 +3169,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
inline int Start() override;
|
inline int Start() override;
|
||||||
inline void Stop() override {
|
inline void Stop() override {
|
||||||
Logger().information("Stopping ");
|
Logger().information("Stopping...");
|
||||||
for( const auto & svr : RESTServers_ )
|
for( const auto & svr : RESTServers_ )
|
||||||
svr->stop();
|
svr->stop();
|
||||||
Pool_.stopAll();
|
Pool_.stopAll();
|
||||||
@@ -3304,7 +3317,6 @@ namespace OpenWifi {
|
|||||||
inline std::string ConfigPath(const std::string &Key);
|
inline std::string ConfigPath(const std::string &Key);
|
||||||
inline std::string Encrypt(const std::string &S);
|
inline std::string Encrypt(const std::string &S);
|
||||||
inline std::string Decrypt(const std::string &S);
|
inline std::string Decrypt(const std::string &S);
|
||||||
inline std::string CreateHash(const std::string &S);
|
|
||||||
inline std::string MakeSystemEventMessage( const std::string & Type ) const;
|
inline std::string MakeSystemEventMessage( const std::string & Type ) const;
|
||||||
[[nodiscard]] inline bool IsValidAPIKEY(const Poco::Net::HTTPServerRequest &Request);
|
[[nodiscard]] inline bool IsValidAPIKEY(const Poco::Net::HTTPServerRequest &Request);
|
||||||
inline static void SavePID();
|
inline static void SavePID();
|
||||||
@@ -3350,7 +3362,6 @@ namespace OpenWifi {
|
|||||||
std::string WWWAssetsDir_;
|
std::string WWWAssetsDir_;
|
||||||
Poco::Crypto::CipherFactory & CipherFactory_ = Poco::Crypto::CipherFactory::defaultFactory();
|
Poco::Crypto::CipherFactory & CipherFactory_ = Poco::Crypto::CipherFactory::defaultFactory();
|
||||||
Poco::Crypto::Cipher * Cipher_ = nullptr;
|
Poco::Crypto::Cipher * Cipher_ = nullptr;
|
||||||
Poco::SHA2Engine SHA2_;
|
|
||||||
MicroServiceMetaMap Services_;
|
MicroServiceMetaMap Services_;
|
||||||
std::string MyHash_;
|
std::string MyHash_;
|
||||||
std::string MyPrivateEndPoint_;
|
std::string MyPrivateEndPoint_;
|
||||||
@@ -3521,7 +3532,7 @@ namespace OpenWifi {
|
|||||||
MyPrivateEndPoint_ = ConfigGetString("openwifi.system.uri.private");
|
MyPrivateEndPoint_ = ConfigGetString("openwifi.system.uri.private");
|
||||||
MyPublicEndPoint_ = ConfigGetString("openwifi.system.uri.public");
|
MyPublicEndPoint_ = ConfigGetString("openwifi.system.uri.public");
|
||||||
UIURI_ = ConfigGetString("openwifi.system.uri.ui");
|
UIURI_ = ConfigGetString("openwifi.system.uri.ui");
|
||||||
MyHash_ = CreateHash(MyPublicEndPoint_);
|
MyHash_ = Utils::ComputeHash(MyPublicEndPoint_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MicroServicePostInitialization();
|
void MicroServicePostInitialization();
|
||||||
@@ -3858,11 +3869,6 @@ namespace OpenWifi {
|
|||||||
return Cipher_->decryptString(S, Poco::Crypto::Cipher::Cipher::ENC_BASE64);;
|
return Cipher_->decryptString(S, Poco::Crypto::Cipher::Cipher::ENC_BASE64);;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string MicroService::CreateHash(const std::string &S) {
|
|
||||||
SHA2_.update(S);
|
|
||||||
return Utils::ToHex(SHA2_.digest());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::string MicroService::MakeSystemEventMessage( const std::string & Type ) const {
|
inline std::string MicroService::MakeSystemEventMessage( const std::string & Type ) const {
|
||||||
Poco::JSON::Object Obj;
|
Poco::JSON::Object Obj;
|
||||||
Obj.set(KafkaTopics::ServiceEvents::Fields::EVENT,Type);
|
Obj.set(KafkaTopics::ServiceEvents::Fields::EVENT,Type);
|
||||||
|
|||||||
Reference in New Issue
Block a user