mirror of
				https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
				synced 2025-10-31 10:47:48 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			819 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			819 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| //
 | |
| // Created by stephane bourque on 2021-07-01.
 | |
| //
 | |
| 
 | |
| #include "RESTAPI_validate_token_handler.h"
 | |
| #include "AuthService.h"
 | |
| 
 | |
| namespace OpenWifi {
 | |
|     void RESTAPI_validate_token_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;
 | |
|                 bool Expired = false;
 | |
|                 if (AuthService()->IsValidToken(i.second, SecObj.webtoken, SecObj.userinfo, Expired)) {
 | |
|                     Poco::JSON::Object Obj;
 | |
|                     SecObj.to_json(Obj);
 | |
|                     return ReturnObject(Obj);
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         return NotFound();
 | |
|     }
 | |
| } | 
