mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-02 03:37:51 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -10,21 +10,30 @@ namespace OpenWifi {
|
||||
void RESTAPI_validate_apikey::DoGet() {
|
||||
Poco::URI URI(Request->getURI());
|
||||
auto Parameters = URI.getQueryParameters();
|
||||
std::cout << __LINE__ << std::endl;
|
||||
for(auto const &i:Parameters) {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
if (i.first == "apikey") {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
// can we find this token?
|
||||
SecurityObjects::UserInfoAndPolicy SecObj;
|
||||
bool Expired = false;
|
||||
std::uint64_t expiresOn=0;
|
||||
std::cout << __LINE__ << " > " << i.second << std::endl;
|
||||
if (AuthService()->IsValidApiKey(i.second, SecObj.webtoken, SecObj.userinfo, Expired, expiresOn)) {
|
||||
std::cout << __LINE__ << std::endl;
|
||||
Poco::JSON::Object Answer;
|
||||
SecObj.to_json(Answer);
|
||||
Answer.set("expiresOn", expiresOn);
|
||||
std::cout << __LINE__ << std::endl;
|
||||
return ReturnObject(Answer);
|
||||
}
|
||||
std::cout << __LINE__ << std::endl;
|
||||
return UnAuthorized(RESTAPI::Errors::ACCESS_DENIED);
|
||||
}
|
||||
std::cout << __LINE__ << std::endl;
|
||||
}
|
||||
std::cout << __LINE__ << std::endl;
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user