Refactoring project layout

This commit is contained in:
stephb9959
2021-10-19 19:35:42 -07:00
parent 670e61640f
commit 117e820d1e
76 changed files with 1337 additions and 133 deletions

View File

@@ -0,0 +1,27 @@
//
// Created by stephane bourque on 2021-07-01.
//
#include "RESTAPI_validateToken_handler.h"
#include "../Daemon.h"
#include "../AuthService.h"
#include "../framework/Utils.h"
namespace OpenWifi {
void RESTAPI_validateToken_handler::DoGet() {
Poco::URI URI(Request->getURI());
auto Parameters = URI.getQueryParameters();
for(auto const &i:Parameters) {
if (i.first == "token") {
// can we find this token?
SecurityObjects::UserInfoAndPolicy SecObj;
if (AuthService()->IsValidToken(i.second, SecObj.webtoken, SecObj.userinfo)) {
Poco::JSON::Object Obj;
SecObj.to_json(Obj);
return ReturnObject(Obj);
}
}
}
return NotFound();
}
}