summaryrefslogtreecommitdiffstats
path: root/logic/auth/AuthSession.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-01-27 03:00:49 +0100
committerPetr Mrázek <peterix@gmail.com>2014-01-27 03:00:49 +0100
commitffbc5bb62c0cd771b26cb1d9b5afdccef77075b4 (patch)
tree78b10cee3dc25acba02954aaf4f0e44ee4c295de /logic/auth/AuthSession.h
parentd7113de3bd3cb43b1bc68792cd27a716b012f2b5 (diff)
downloadMultiMC-ffbc5bb62c0cd771b26cb1d9b5afdccef77075b4.tar
MultiMC-ffbc5bb62c0cd771b26cb1d9b5afdccef77075b4.tar.gz
MultiMC-ffbc5bb62c0cd771b26cb1d9b5afdccef77075b4.tar.lz
MultiMC-ffbc5bb62c0cd771b26cb1d9b5afdccef77075b4.tar.xz
MultiMC-ffbc5bb62c0cd771b26cb1d9b5afdccef77075b4.zip
Offline mode can be used even when online.
Allow the user to pick a player name for offline mode. Big auth refactor. Now using session objects instead of the accounts themselves. Sessions only last for one instance start and hold all the auth and player data.
Diffstat (limited to 'logic/auth/AuthSession.h')
-rw-r--r--logic/auth/AuthSession.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/logic/auth/AuthSession.h b/logic/auth/AuthSession.h
new file mode 100644
index 00000000..2ac170fa
--- /dev/null
+++ b/logic/auth/AuthSession.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#include <QString>
+#include <QMultiMap>
+#include <memory>
+
+struct User
+{
+ QString id;
+ QMultiMap<QString, QString> properties;
+};
+
+struct AuthSession
+{
+ bool MakeOffline(QString offline_playername);
+
+ QString serializeUserProperties();
+
+ enum Status
+ {
+ Undetermined,
+ RequiresPassword,
+ PlayableOffline,
+ PlayableOnline
+ } status = Undetermined;
+
+ User u;
+
+ // client token
+ QString client_token;
+ // account user name
+ QString username;
+ // combined session ID
+ QString session;
+ // volatile auth token
+ QString access_token;
+ // profile name
+ QString player_name;
+ // profile ID
+ QString uuid;
+ // 'legacy' or 'mojang', depending on account type
+ QString user_type;
+ // Did the auth server reply?
+ bool auth_server_online = false;
+ // Did the user request online mode?
+ bool wants_online = true;
+};
+
+typedef std::shared_ptr<AuthSession> AuthSessionPtr;