mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-11-01 19:27:59 +00:00
Adding refresh token processing for subscribers.
This commit is contained in:
@@ -54,9 +54,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()->RefreshSubToken(*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