@ -1,36 +1,33 @@
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QDebug>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#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();
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
#include <QSet>
|
||||
#include <QNetworkReply>
|
||||
#include <QImage>
|
||||
#include <QList>
|
||||
#include <QNetworkReply>
|
||||
#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;
|
||||
};
|
||||
|
@ -1,15 +1,16 @@
|
||||
#include "MSA.h"
|
||||
|
||||
#include "minecraft/auth/steps/MSAStep.h"
|
||||
#include "minecraft/auth/steps/XboxUserStep.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/LauncherLoginStep.h"
|
||||
#include "minecraft/auth/steps/MSAStep.h"
|
||||
#include "minecraft/auth/steps/MinecraftProfileStep.h"
|
||||
#include "minecraft/auth/steps/XboxAuthorizationStep.h"
|
||||
#include "minecraft/auth/steps/XboxProfileStep.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"));
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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);
|
||||
};
|
||||
|
Reference in New Issue
Block a user