#pragma once #include #include "QObjectPtr.h" #include #include #include #include #include "multimc_logic_export.h" #include "minecraft/auth/AccountProfile.h" class BaseAuthProvider; typedef std::shared_ptr AuthProviderPtr; /*! * \brief Base class for auth provider. * This class implements many functions that are common between providers and * provides a standard interface for all providers. * * To create a new provider, create a new class inheriting from this class, * implement the pure virtual functions, and */ class MULTIMC_LOGIC_EXPORT BaseAuthProvider : public QObject //, public std::enable_shared_from_this { Q_OBJECT public: virtual ~BaseAuthProvider(){}; // Unique id for provider virtual QString id() { return "base"; }; // Name of provider that displayed in account selector and list virtual QString displayName() { return "Base"; }; // Use dummy auth on login instead of calling endpoint virtual bool dummyAuth() { return false; }; // Endpoint for authlib injector (use empty if authlib injector isn't required) virtual QString injectorEndpoint() { return ""; }; // Endpoint for authentication virtual QString authEndpoint() { return ""; }; // Function to get url of skin to display in launcher virtual QUrl resolveSkinUrl(AccountProfile profile) { return QUrl(((QString) "https://crafatar.com/skins/%1.png").arg(profile.id)); }; // Can change skin (currently only mojang support) virtual bool canChangeSkin() { return false; } };