aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/auth/flows
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/minecraft/auth/flows')
-rw-r--r--launcher/minecraft/auth/flows/AuthFlow.cpp44
-rw-r--r--launcher/minecraft/auth/flows/AuthFlow.h29
-rw-r--r--launcher/minecraft/auth/flows/MSA.cpp19
-rw-r--r--launcher/minecraft/auth/flows/MSA.h20
-rw-r--r--launcher/minecraft/auth/flows/Mojang.cpp19
-rw-r--r--launcher/minecraft/auth/flows/Mojang.h23
-rw-r--r--launcher/minecraft/auth/flows/Offline.cpp12
-rw-r--r--launcher/minecraft/auth/flows/Offline.h20
8 files changed, 72 insertions, 114 deletions
diff --git a/launcher/minecraft/auth/flows/AuthFlow.cpp b/launcher/minecraft/auth/flows/AuthFlow.cpp
index 4f78e8c3..c51839a8 100644
--- a/launcher/minecraft/auth/flows/AuthFlow.cpp
+++ b/launcher/minecraft/auth/flows/AuthFlow.cpp
@@ -1,36 +1,33 @@
+#include <QDebug>
#include <QNetworkAccessManager>
-#include <QNetworkRequest>
#include <QNetworkReply>
-#include <QDebug>
+#include <QNetworkRequest>
#include "AuthFlow.h"
#include "katabasis/Globals.h"
#include <Application.h>
-AuthFlow::AuthFlow(AccountData * data, QObject *parent) :
- AccountTask(data, parent)
-{
-}
+AuthFlow::AuthFlow(AccountData* data, QObject* parent) : AccountTask(data, parent) {}
-void AuthFlow::succeed() {
+void AuthFlow::succeed()
+{
m_data->validity_ = Katabasis::Validity::Certain;
- changeState(
- AccountTaskState::STATE_SUCCEEDED,
- tr("Finished all authentication steps")
- );
+ changeState(AccountTaskState::STATE_SUCCEEDED, tr("Finished all authentication steps"));
}
-void AuthFlow::executeTask() {
- if(m_currentStep) {
+void AuthFlow::executeTask()
+{
+ if (m_currentStep) {
return;
}
changeState(AccountTaskState::STATE_WORKING, tr("Initializing"));
nextStep();
}
-void AuthFlow::nextStep() {
- if(m_steps.size() == 0) {
+void AuthFlow::nextStep()
+{
+ if (m_steps.size() == 0) {
// we got to the end without an incident... assume this is all.
m_currentStep.reset();
succeed();
@@ -46,15 +43,13 @@ void AuthFlow::nextStep() {
m_currentStep->perform();
}
-
-QString AuthFlow::getStateMessage() const {
- switch (m_taskState)
- {
+QString AuthFlow::getStateMessage() const
+{
+ switch (m_taskState) {
case AccountTaskState::STATE_WORKING: {
- if(m_currentStep) {
+ if (m_currentStep) {
return m_currentStep->describe();
- }
- else {
+ } else {
return tr("Working...");
}
}
@@ -64,8 +59,9 @@ QString AuthFlow::getStateMessage() const {
}
}
-void AuthFlow::stepFinished(AccountTaskState resultingState, QString message) {
- if(changeState(resultingState, message)) {
+void AuthFlow::stepFinished(AccountTaskState resultingState, QString message)
+{
+ if (changeState(resultingState, message)) {
nextStep();
}
}
diff --git a/launcher/minecraft/auth/flows/AuthFlow.h b/launcher/minecraft/auth/flows/AuthFlow.h
index e067cc99..c2c412ab 100644
--- a/launcher/minecraft/auth/flows/AuthFlow.h
+++ b/launcher/minecraft/auth/flows/AuthFlow.h
@@ -1,45 +1,42 @@
#pragma once
-#include <QObject>
+#include <QImage>
#include <QList>
-#include <QVector>
-#include <QSet>
#include <QNetworkReply>
-#include <QImage>
+#include <QObject>
+#include <QSet>
+#include <QVector>
#include <katabasis/DeviceFlow.h>
-#include "minecraft/auth/Yggdrasil.h"
#include "minecraft/auth/AccountData.h"
#include "minecraft/auth/AccountTask.h"
#include "minecraft/auth/AuthStep.h"
+#include "minecraft/auth/Yggdrasil.h"
-class AuthFlow : public AccountTask
-{
+class AuthFlow : public AccountTask {
Q_OBJECT
-public:
- explicit AuthFlow(AccountData * data, QObject *parent = 0);
+ public:
+ explicit AuthFlow(AccountData* data, QObject* parent = 0);
- Katabasis::Validity validity() {
- return m_data->validity_;
- };
+ Katabasis::Validity validity() { return m_data->validity_; };
QString getStateMessage() const override;
void executeTask() override;
-signals:
+ signals:
void activityChanged(Katabasis::Activity activity);
-private slots:
+ private slots:
void stepFinished(AccountTaskState resultingState, QString message);
-protected:
+ protected:
void succeed();
void nextStep();
-protected:
+ protected:
QList<AuthStep::Ptr> m_steps;
AuthStep::Ptr m_currentStep;
};
diff --git a/launcher/minecraft/auth/flows/MSA.cpp b/launcher/minecraft/auth/flows/MSA.cpp
index f1987e0c..f0399342 100644
--- a/launcher/minecraft/auth/flows/MSA.cpp
+++ b/launcher/minecraft/auth/flows/MSA.cpp
@@ -1,15 +1,16 @@
#include "MSA.h"
+#include "minecraft/auth/steps/EntitlementsStep.h"
+#include "minecraft/auth/steps/GetSkinStep.h"
+#include "minecraft/auth/steps/LauncherLoginStep.h"
#include "minecraft/auth/steps/MSAStep.h"
-#include "minecraft/auth/steps/XboxUserStep.h"
+#include "minecraft/auth/steps/MinecraftProfileStep.h"
#include "minecraft/auth/steps/XboxAuthorizationStep.h"
-#include "minecraft/auth/steps/LauncherLoginStep.h"
#include "minecraft/auth/steps/XboxProfileStep.h"
-#include "minecraft/auth/steps/EntitlementsStep.h"
-#include "minecraft/auth/steps/MinecraftProfileStep.h"
-#include "minecraft/auth/steps/GetSkinStep.h"
+#include "minecraft/auth/steps/XboxUserStep.h"
-MSASilent::MSASilent(AccountData* data, QObject* parent) : AuthFlow(data, parent) {
+MSASilent::MSASilent(AccountData* data, QObject* parent) : AuthFlow(data, parent)
+{
m_steps.append(makeShared<MSAStep>(m_data, MSAStep::Action::Refresh));
m_steps.append(makeShared<XboxUserStep>(m_data));
m_steps.append(makeShared<XboxAuthorizationStep>(m_data, &m_data->xboxApiToken, "http://xboxlive.com", "Xbox"));
@@ -21,10 +22,8 @@ MSASilent::MSASilent(AccountData* data, QObject* parent) : AuthFlow(data, parent
m_steps.append(makeShared<GetSkinStep>(m_data));
}
-MSAInteractive::MSAInteractive(
- AccountData* data,
- QObject* parent
-) : AuthFlow(data, parent) {
+MSAInteractive::MSAInteractive(AccountData* data, QObject* parent) : AuthFlow(data, parent)
+{
m_steps.append(makeShared<MSAStep>(m_data, MSAStep::Action::Login));
m_steps.append(makeShared<XboxUserStep>(m_data));
m_steps.append(makeShared<XboxAuthorizationStep>(m_data, &m_data->xboxApiToken, "http://xboxlive.com", "Xbox"));
diff --git a/launcher/minecraft/auth/flows/MSA.h b/launcher/minecraft/auth/flows/MSA.h
index 14a4ff43..e403d530 100644
--- a/launcher/minecraft/auth/flows/MSA.h
+++ b/launcher/minecraft/auth/flows/MSA.h
@@ -1,22 +1,14 @@
#pragma once
#include "AuthFlow.h"
-class MSAInteractive : public AuthFlow
-{
+class MSAInteractive : public AuthFlow {
Q_OBJECT
-public:
- explicit MSAInteractive(
- AccountData *data,
- QObject *parent = 0
- );
+ public:
+ explicit MSAInteractive(AccountData* data, QObject* parent = 0);
};
-class MSASilent : public AuthFlow
-{
+class MSASilent : public AuthFlow {
Q_OBJECT
-public:
- explicit MSASilent(
- AccountData * data,
- QObject *parent = 0
- );
+ public:
+ explicit MSASilent(AccountData* data, QObject* parent = 0);
};
diff --git a/launcher/minecraft/auth/flows/Mojang.cpp b/launcher/minecraft/auth/flows/Mojang.cpp
index 5900ea98..7e2db16f 100644
--- a/launcher/minecraft/auth/flows/Mojang.cpp
+++ b/launcher/minecraft/auth/flows/Mojang.cpp
@@ -1,25 +1,20 @@
#include "Mojang.h"
-#include "minecraft/auth/steps/YggdrasilStep.h"
-#include "minecraft/auth/steps/MinecraftProfileStepMojang.h"
-#include "minecraft/auth/steps/MigrationEligibilityStep.h"
#include "minecraft/auth/steps/GetSkinStep.h"
+#include "minecraft/auth/steps/MigrationEligibilityStep.h"
+#include "minecraft/auth/steps/MinecraftProfileStepMojang.h"
+#include "minecraft/auth/steps/YggdrasilStep.h"
-MojangRefresh::MojangRefresh(
- AccountData *data,
- QObject *parent
-) : AuthFlow(data, parent) {
+MojangRefresh::MojangRefresh(AccountData* data, QObject* parent) : AuthFlow(data, parent)
+{
m_steps.append(makeShared<YggdrasilStep>(m_data, QString()));
m_steps.append(makeShared<MinecraftProfileStepMojang>(m_data));
m_steps.append(makeShared<MigrationEligibilityStep>(m_data));
m_steps.append(makeShared<GetSkinStep>(m_data));
}
-MojangLogin::MojangLogin(
- AccountData *data,
- QString password,
- QObject *parent
-): AuthFlow(data, parent), m_password(password) {
+MojangLogin::MojangLogin(AccountData* data, QString password, QObject* parent) : AuthFlow(data, parent), m_password(password)
+{
m_steps.append(makeShared<YggdrasilStep>(m_data, m_password));
m_steps.append(makeShared<MinecraftProfileStepMojang>(m_data));
m_steps.append(makeShared<MigrationEligibilityStep>(m_data));
diff --git a/launcher/minecraft/auth/flows/Mojang.h b/launcher/minecraft/auth/flows/Mojang.h
index c09c81a8..779ca7e3 100644
--- a/launcher/minecraft/auth/flows/Mojang.h
+++ b/launcher/minecraft/auth/flows/Mojang.h
@@ -1,26 +1,17 @@
#pragma once
#include "AuthFlow.h"
-class MojangRefresh : public AuthFlow
-{
+class MojangRefresh : public AuthFlow {
Q_OBJECT
-public:
- explicit MojangRefresh(
- AccountData *data,
- QObject *parent = 0
- );
+ public:
+ explicit MojangRefresh(AccountData* data, QObject* parent = 0);
};
-class MojangLogin : public AuthFlow
-{
+class MojangLogin : public AuthFlow {
Q_OBJECT
-public:
- explicit MojangLogin(
- AccountData *data,
- QString password,
- QObject *parent = 0
- );
+ public:
+ explicit MojangLogin(AccountData* data, QString password, QObject* parent = 0);
-private:
+ private:
QString m_password;
};
diff --git a/launcher/minecraft/auth/flows/Offline.cpp b/launcher/minecraft/auth/flows/Offline.cpp
index d5c63271..3770b869 100644
--- a/launcher/minecraft/auth/flows/Offline.cpp
+++ b/launcher/minecraft/auth/flows/Offline.cpp
@@ -2,16 +2,12 @@
#include "minecraft/auth/steps/OfflineStep.h"
-OfflineRefresh::OfflineRefresh(
- AccountData *data,
- QObject *parent
-) : AuthFlow(data, parent) {
+OfflineRefresh::OfflineRefresh(AccountData* data, QObject* parent) : AuthFlow(data, parent)
+{
m_steps.append(makeShared<OfflineStep>(m_data));
}
-OfflineLogin::OfflineLogin(
- AccountData *data,
- QObject *parent
-) : AuthFlow(data, parent) {
+OfflineLogin::OfflineLogin(AccountData* data, QObject* parent) : AuthFlow(data, parent)
+{
m_steps.append(makeShared<OfflineStep>(m_data));
}
diff --git a/launcher/minecraft/auth/flows/Offline.h b/launcher/minecraft/auth/flows/Offline.h
index 5d1f83a4..2bc9c761 100644
--- a/launcher/minecraft/auth/flows/Offline.h
+++ b/launcher/minecraft/auth/flows/Offline.h
@@ -1,22 +1,14 @@
#pragma once
#include "AuthFlow.h"
-class OfflineRefresh : public AuthFlow
-{
+class OfflineRefresh : public AuthFlow {
Q_OBJECT
-public:
- explicit OfflineRefresh(
- AccountData *data,
- QObject *parent = 0
- );
+ public:
+ explicit OfflineRefresh(AccountData* data, QObject* parent = 0);
};
-class OfflineLogin : public AuthFlow
-{
+class OfflineLogin : public AuthFlow {
Q_OBJECT
-public:
- explicit OfflineLogin(
- AccountData *data,
- QObject *parent = 0
- );
+ public:
+ explicit OfflineLogin(AccountData* data, QObject* parent = 0);
};