web_service: Change authentication system to use JWT (#4041)
* Change authentication system to JWT * Address review comments * Get rid of global variable, fix some documentations, fix a bug when verificating * Refactor PostJson to avoid code duplication * Rename jwt_token, add functionality to request a new JWT when getting a 401 * Take bools by value instead of const reference * Send request again when JWT is invalid and use forward declarations * Omit brackets
This commit is contained in:
@ -84,7 +84,7 @@ void RoomJson::AddPlayer(const std::string& nickname,
|
||||
|
||||
std::future<Common::WebResult> RoomJson::Announce() {
|
||||
nlohmann::json json = room;
|
||||
return PostJson(endpoint_url, json.dump(), false, username, token);
|
||||
return PostJson(endpoint_url, json.dump(), false);
|
||||
}
|
||||
|
||||
void RoomJson::ClearPlayers() {
|
||||
@ -99,14 +99,13 @@ std::future<AnnounceMultiplayerRoom::RoomList> RoomJson::GetRoomList(std::functi
|
||||
func();
|
||||
return room_list;
|
||||
};
|
||||
return GetJson<AnnounceMultiplayerRoom::RoomList>(DeSerialize, endpoint_url, true, username,
|
||||
token);
|
||||
return GetJson<AnnounceMultiplayerRoom::RoomList>(DeSerialize, endpoint_url, true);
|
||||
}
|
||||
|
||||
void RoomJson::Delete() {
|
||||
nlohmann::json json;
|
||||
json["id"] = room.UID;
|
||||
DeleteJson(endpoint_url, json.dump(), username, token);
|
||||
DeleteJson(endpoint_url, json.dump());
|
||||
}
|
||||
|
||||
} // namespace WebService
|
||||
|
Reference in New Issue
Block a user