mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-01 19:27:59 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -51,13 +51,13 @@ namespace OpenWifi {
|
|||||||
RefreshTokenLifeSpan_ = (uint64_t) MicroService::instance().ConfigGetInt("authentication.refresh_token.lifespan", 90 * 24 * 60 * 600);
|
RefreshTokenLifeSpan_ = (uint64_t) MicroService::instance().ConfigGetInt("authentication.refresh_token.lifespan", 90 * 24 * 60 * 600);
|
||||||
HowManyOldPassword_ = MicroService::instance().ConfigGetInt("authentication.oldpasswords", 5);
|
HowManyOldPassword_ = MicroService::instance().ConfigGetInt("authentication.oldpasswords", 5);
|
||||||
|
|
||||||
AccessPolicy_ = MicroService::instance().ConfigPath("openwifi.document.policy.access", "/wwwassets/access_policy.html");
|
AccessPolicy_ = MicroService::instance().ConfigGetString("openwifi.document.policy.access", "/wwwassets/access_policy.html");
|
||||||
PasswordPolicy_ = MicroService::instance().ConfigPath("openwifi.document.policy.password", "/wwwassets/password_policy.html");
|
PasswordPolicy_ = MicroService::instance().ConfigGetString("openwifi.document.policy.password", "/wwwassets/password_policy.html");
|
||||||
PasswordValidation_ = PasswordValidationStr_ = MicroService::instance().ConfigGetString("authentication.validation.expression",DefaultPassword_8_u_l_n_1);
|
PasswordValidation_ = PasswordValidationStr_ = MicroService::instance().ConfigGetString("authentication.validation.expression",DefaultPassword_8_u_l_n_1);
|
||||||
|
|
||||||
SubPasswordValidation_ = SubPasswordValidationStr_ = MicroService::instance().ConfigGetString("subscriber.validation.expression",DefaultPassword_8_u_l_n_1);
|
SubPasswordValidation_ = SubPasswordValidationStr_ = MicroService::instance().ConfigGetString("subscriber.validation.expression",DefaultPassword_8_u_l_n_1);
|
||||||
SubAccessPolicy_ = MicroService::instance().ConfigPath("subscriber.policy.access", "/wwwassets/access_policy.html");
|
SubAccessPolicy_ = MicroService::instance().ConfigGetString("subscriber.policy.access", "/wwwassets/access_policy.html");
|
||||||
SubPasswordPolicy_ = MicroService::instance().ConfigPath("subscriber.policy.password", "/wwwassets/password_policy.html");
|
SubPasswordPolicy_ = MicroService::instance().ConfigGetString("subscriber.policy.password", "/wwwassets/password_policy.html");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2446,6 +2446,7 @@ namespace OpenWifi {
|
|||||||
Poco::Net::HTTPServerResponse *Response= nullptr;
|
Poco::Net::HTTPServerResponse *Response= nullptr;
|
||||||
SecurityObjects::UserInfoAndPolicy UserInfo_;
|
SecurityObjects::UserInfoAndPolicy UserInfo_;
|
||||||
QueryBlock QB_;
|
QueryBlock QB_;
|
||||||
|
const std::string & Requester() const { return REST_Requester_; }
|
||||||
protected:
|
protected:
|
||||||
BindingMap Bindings_;
|
BindingMap Bindings_;
|
||||||
Poco::URI::QueryParameters Parameters_;
|
Poco::URI::QueryParameters Parameters_;
|
||||||
@@ -2462,6 +2463,7 @@ namespace OpenWifi {
|
|||||||
RateLimit MyRates_;
|
RateLimit MyRates_;
|
||||||
uint64_t TransactionId_;
|
uint64_t TransactionId_;
|
||||||
Poco::JSON::Object::Ptr ParsedBody_;
|
Poco::JSON::Object::Ptr ParsedBody_;
|
||||||
|
std::string REST_Requester_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RESTAPI_UnknownRequestHandler : public RESTAPIHandler {
|
class RESTAPI_UnknownRequestHandler : public RESTAPIHandler {
|
||||||
@@ -3044,6 +3046,7 @@ namespace OpenWifi {
|
|||||||
RESTServers_.clear();
|
RESTServers_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void reinitialize(Poco::Util::Application &self) override;
|
inline void reinitialize(Poco::Util::Application &self) override;
|
||||||
|
|
||||||
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
||||||
@@ -3051,6 +3054,7 @@ namespace OpenWifi {
|
|||||||
Utils::SetThreadName(fmt::format("x-rest:{}",Id).c_str());
|
Utils::SetThreadName(fmt::format("x-rest:{}",Id).c_str());
|
||||||
return RESTAPI_ExtRouter(Path, Bindings, Logger(), Server_, Id);
|
return RESTAPI_ExtRouter(Path, Bindings, Logger(), Server_, Id);
|
||||||
}
|
}
|
||||||
|
const Poco::ThreadPool & Pool() { return Pool_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
|
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
|
||||||
@@ -3183,6 +3187,8 @@ namespace OpenWifi {
|
|||||||
Utils::SetThreadName(fmt::format("i-rest:{}",Id).c_str());
|
Utils::SetThreadName(fmt::format("i-rest:{}",Id).c_str());
|
||||||
return RESTAPI_IntRouter(Path, Bindings, Logger(), Server_, Id);
|
return RESTAPI_IntRouter(Path, Bindings, Logger(), Server_, Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Poco::ThreadPool & Pool() { return Pool_; }
|
||||||
private:
|
private:
|
||||||
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
|
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
|
||||||
Poco::ThreadPool Pool_{"i-rest",2,16};
|
Poco::ThreadPool Pool_{"i-rest",2,16};
|
||||||
@@ -4754,6 +4760,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto Id = Request->get("X-INTERNAL-NAME", "unknown");
|
auto Id = Request->get("X-INTERNAL-NAME", "unknown");
|
||||||
|
REST_Requester_ = Id;
|
||||||
if(Server_.LogIt(Request->getMethod(),true)) {
|
if(Server_.LogIt(Request->getMethod(),true)) {
|
||||||
Logger_.debug(fmt::format("I-REQ-ALLOWED({}): User='{}' Method={} Path={}",
|
Logger_.debug(fmt::format("I-REQ-ALLOWED({}): User='{}' Method={} Path={}",
|
||||||
Utils::FormatIPv6(Request->clientAddress().toString()), Id,
|
Utils::FormatIPv6(Request->clientAddress().toString()), Id,
|
||||||
@@ -4777,6 +4784,7 @@ namespace OpenWifi {
|
|||||||
#else
|
#else
|
||||||
if (AuthClient()->IsAuthorized( SessionToken_, UserInfo_, Expired, Contacted, Sub)) {
|
if (AuthClient()->IsAuthorized( SessionToken_, UserInfo_, Expired, Contacted, Sub)) {
|
||||||
#endif
|
#endif
|
||||||
|
REST_Requester_ = UserInfo_.userinfo.email;
|
||||||
if(Server_.LogIt(Request->getMethod(),true)) {
|
if(Server_.LogIt(Request->getMethod(),true)) {
|
||||||
Logger_.debug(fmt::format("X-REQ-ALLOWED({}): User='{}@{}' Method={} Path={}",
|
Logger_.debug(fmt::format("X-REQ-ALLOWED({}): User='{}@{}' Method={} Path={}",
|
||||||
UserInfo_.userinfo.email,
|
UserInfo_.userinfo.email,
|
||||||
|
|||||||
Reference in New Issue
Block a user