mirror of
				https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
				synced 2025-10-31 18:57:51 +00:00 
			
		
		
		
	Adding refresh token processing.
This commit is contained in:
		| @@ -60,9 +60,22 @@ namespace OpenWifi { | ||||
|         auto userId = GetS(RESTAPI::Protocol::USERID, Obj); | ||||
|         auto password = GetS(RESTAPI::Protocol::PASSWORD, Obj); | ||||
|         auto newPassword = GetS(RESTAPI::Protocol::NEWPASSWORD, Obj); | ||||
|         auto refreshToken = GetS("refresh_token", Obj); | ||||
|         auto grant_type = GetParameter("grant_type"); | ||||
|  | ||||
|         Poco::toLowerInPlace(userId); | ||||
|  | ||||
|         if(!refreshToken.empty() && grant_type == "refresh_token") { | ||||
|             SecurityObjects::UserInfoAndPolicy UInfo; | ||||
|             if(AuthService()->RefreshUserToken(*Request, refreshToken, UInfo)) { | ||||
|                 Poco::JSON::Object  Answer; | ||||
|                 UInfo.webtoken.to_json(Answer); | ||||
|                 return ReturnObject(Answer); | ||||
|             } else { | ||||
|                 return UnAuthorized(RESTAPI::Errors::InvalidCredentials, CANNOT_REFRESH_TOKEN); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if(GetBoolParameter(RESTAPI::Protocol::REQUIREMENTS, false)) { | ||||
|             Logger_.information(fmt::format("POLICY-REQUEST({}): Request.", Request->clientAddress().toString())); | ||||
|             Poco::JSON::Object  Answer; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 stephb9959
					stephb9959