mirror of
				https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
				synced 2025-11-03 20:27:45 +00:00 
			
		
		
		
	Completing RESTAPI refactor.
This commit is contained in:
		@@ -9,27 +9,20 @@
 | 
			
		||||
 | 
			
		||||
namespace OpenWifi {
 | 
			
		||||
    void RESTAPI_validateToken_handler::DoGet() {
 | 
			
		||||
        try {
 | 
			
		||||
            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;
 | 
			
		||||
                    }
 | 
			
		||||
        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();
 | 
			
		||||
            return;
 | 
			
		||||
        } catch (const Poco::Exception &E) {
 | 
			
		||||
            Logger_.log(E);
 | 
			
		||||
        }
 | 
			
		||||
        BadRequest("Internal error.");
 | 
			
		||||
        NotFound();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user