summaryrefslogtreecommitdiffstats
path: root/src/network/verify_user.h
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2022-07-06 02:20:39 +0200
committerFearlessTobi <thm.frey@gmail.com>2022-07-25 21:57:14 +0200
commitdcfe0a5febb252e3a4f40c1b25765740a269467f (patch)
tree3f06aa974d4bfba52df45697070ef112b701054b /src/network/verify_user.h
parentMerge pull request #8564 from lat9nq/dinner-fork (diff)
downloadyuzu-dcfe0a5febb252e3a4f40c1b25765740a269467f.tar
yuzu-dcfe0a5febb252e3a4f40c1b25765740a269467f.tar.gz
yuzu-dcfe0a5febb252e3a4f40c1b25765740a269467f.tar.bz2
yuzu-dcfe0a5febb252e3a4f40c1b25765740a269467f.tar.lz
yuzu-dcfe0a5febb252e3a4f40c1b25765740a269467f.tar.xz
yuzu-dcfe0a5febb252e3a4f40c1b25765740a269467f.tar.zst
yuzu-dcfe0a5febb252e3a4f40c1b25765740a269467f.zip
Diffstat (limited to '')
-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 @@
+// 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;
+ bool moderator = false; ///< Whether the user is a Citra Moderator.
+};
+
+/**
+ * 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