network, web_service: Add Verification backend and use new lobby API
Added verify_backend to load user_data for members. and removed method to generate UID as this is now done server-side. Added GetUsername function and a "token" param to room_member. Also added a username to ChatEntry, so that the username can be shown (along with nicknames) in the chat dialog.
This commit is contained in:
parent
5f0e189238
commit
1a8841f96e
12 changed files with 262 additions and 45 deletions
45
src/network/verify_user.h
Normal file
45
src/network/verify_user.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
// Copyright 2018 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "common/logging/log.h"
|
||||
|
||||
namespace Network::VerifyUser {
|
||||
|
||||
struct UserData {
|
||||
std::string username;
|
||||
std::string display_name;
|
||||
std::string avatar_url;
|
||||
};
|
||||
|
||||
/**
|
||||
* A backend used for verifying users and loading user data.
|
||||
*/
|
||||
class Backend {
|
||||
public:
|
||||
virtual ~Backend();
|
||||
|
||||
/**
|
||||
* Verifies the given token and loads the information into a UserData struct.
|
||||
* @param verify_UID A GUID that may be used for verification.
|
||||
* @param token A token that contains user data and verification data. The format and content is
|
||||
* decided by backends.
|
||||
*/
|
||||
virtual UserData LoadUserData(const std::string& verify_UID, const std::string& token) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* A null backend where the token is ignored.
|
||||
* No verification is performed here and the function returns an empty UserData.
|
||||
*/
|
||||
class NullBackend final : public Backend {
|
||||
public:
|
||||
~NullBackend();
|
||||
|
||||
UserData LoadUserData(const std::string& verify_UID, const std::string& token) override;
|
||||
};
|
||||
|
||||
} // namespace Network::VerifyUser
|
Loading…
Add table
Add a link
Reference in a new issue