mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-03 12:17:46 +00:00
28 lines
823 B
C++
28 lines
823 B
C++
//
|
|
// Created by stephane bourque on 2021-07-01.
|
|
//
|
|
|
|
#include "RESTAPI_validateToken_handler.h"
|
|
#include "Daemon.h"
|
|
#include "AuthService.h"
|
|
#include "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);
|
|
ReturnObject(Obj);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
NotFound();
|
|
}
|
|
} |