summaryrefslogtreecommitdiff
path: root/src/network/verify_user.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/verify_user.h')
-rw-r--r--src/network/verify_user.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/network/verify_user.h b/src/network/verify_user.h
new file mode 100644
index 000000000..01b9877c8
--- /dev/null
+++ b/src/network/verify_user.h
@@ -0,0 +1,46 @@
1// Copyright 2018 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <string>
8#include "common/logging/log.h"
9
10namespace Network::VerifyUser {
11
12struct UserData {
13 std::string username;
14 std::string display_name;
15 std::string avatar_url;
16 bool moderator = false; ///< Whether the user is a Citra Moderator.
17};
18
19/**
20 * A backend used for verifying users and loading user data.
21 */
22class Backend {
23public:
24 virtual ~Backend();
25
26 /**
27 * Verifies the given token and loads the information into a UserData struct.
28 * @param verify_UID A GUID that may be used for verification.
29 * @param token A token that contains user data and verification data. The format and content is
30 * decided by backends.
31 */
32 virtual UserData LoadUserData(const std::string& verify_UID, const std::string& token) = 0;
33};
34
35/**
36 * A null backend where the token is ignored.
37 * No verification is performed here and the function returns an empty UserData.
38 */
39class NullBackend final : public Backend {
40public:
41 ~NullBackend();
42
43 UserData LoadUserData(const std::string& verify_UID, const std::string& token) override;
44};
45
46} // namespace Network::VerifyUser