Merge pull request #589 from kasenvr/feature/oauth2-kalila

Feature/oauth2 kalila
This commit is contained in:
David Rowe 2020-08-05 20:18:35 +12:00 committed by GitHub
commit 1e0498aaa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 133 additions and 37 deletions

View file

@ -414,6 +414,7 @@
"name": "group_permissions", "name": "group_permissions",
"type": "table", "type": "table",
"caption": "Permissions for Users in Groups", "caption": "Permissions for Users in Groups",
"help": "For groups that are provided from WordPress you need to denote them by putting an \"@\" symbol in front of each item, e.g., \"@silver\"".
"categorize_by_key": "permissions_id", "categorize_by_key": "permissions_id",
"can_add_new_categories": true, "can_add_new_categories": true,
"can_add_new_rows": false, "can_add_new_rows": false,
@ -542,6 +543,7 @@
"name": "group_forbiddens", "name": "group_forbiddens",
"type": "table", "type": "table",
"caption": "Permissions Denied to Users in Groups", "caption": "Permissions Denied to Users in Groups",
"help": "For groups that are provided from WordPress you need to denote them by putting an \"@\" symbol in front of each item, e.g., \"@silver\"".
"categorize_by_key": "permissions_id", "categorize_by_key": "permissions_id",
"can_add_new_categories": true, "can_add_new_categories": true,
"can_add_new_rows": false, "can_add_new_rows": false,

View file

@ -45,6 +45,7 @@ Item {
property bool lostFocus: false property bool lostFocus: false
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp() readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
// If not logging into domain, then we must be logging into the metaverse...
readonly property bool isLoggingInToDomain: loginDialog.getDomainLoginRequested() readonly property bool isLoggingInToDomain: loginDialog.getDomainLoginRequested()
readonly property string domainLoginDomain: loginDialog.getDomainLoginDomain() readonly property string domainLoginDomain: loginDialog.getDomainLoginDomain()
@ -94,7 +95,7 @@ Item {
} }
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": linkAccountBody.withSteam, bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": linkAccountBody.withSteam,
"withOculus": linkAccountBody.withOculus, "linkSteam": linkAccountBody.linkSteam, "linkOculus": linkAccountBody.linkOculus, "withOculus": linkAccountBody.withOculus, "linkSteam": linkAccountBody.linkSteam, "linkOculus": linkAccountBody.linkOculus,
"displayName":displayNameField.text, "isLoggingInToDomain": linkAccountBody.isLoggingInToDomain }); "displayName":displayNameField.text, "isLoggingInToDomain": linkAccountBody.isLoggingInToDomain, "domainLoginDomain": linkAccountBody.domainLoginDomain });
} }
function init() { function init() {
@ -105,13 +106,15 @@ Item {
loginErrorMessage.wrapMode = Text.WordWrap; loginErrorMessage.wrapMode = Text.WordWrap;
errorContainer.height = (loginErrorMessageTextMetrics.width / displayNameField.width) * loginErrorMessageTextMetrics.height; errorContainer.height = (loginErrorMessageTextMetrics.width / displayNameField.width) * loginErrorMessageTextMetrics.height;
} }
var domainLoginText = "Log In to Domain\n" + domainLoginDomain;
loginDialogText.text = (!isLoggingInToDomain) ? "Log In to Metaverse" : domainLoginText;
loginButton.text = (!linkAccountBody.linkSteam && !linkAccountBody.linkOculus) ? "Log In" : "Link Account"; loginButton.text = (!linkAccountBody.linkSteam && !linkAccountBody.linkOculus) ? "Log In" : "Link Account";
loginButton.text = (!isLoggingInToDomain) ? "Log In" : "Log In to Domain"; loginButton.text = (!isLoggingInToDomain) ? "Log In to Metaverse" : "Log In to Domain";
loginButton.color = hifi.buttons.blue; loginButton.color = hifi.buttons.blue;
displayNameField.placeholderText = "Display Name (optional)"; displayNameField.placeholderText = "Display Name (optional)";
var savedDisplayName = Settings.getValue("Avatar/displayName", ""); var savedDisplayName = Settings.getValue("Avatar/displayName", "");
displayNameField.text = savedDisplayName; displayNameField.text = savedDisplayName;
emailField.placeholderText = "Username or Email"; emailField.placeholderText = (!isLoggingInToDomain) ? "Username or Email" : "Username";
if (!isLoggingInToDomain) { if (!isLoggingInToDomain) {
var savedUsername = Settings.getValue("keepMeLoggedIn/savedUsername", ""); var savedUsername = Settings.getValue("keepMeLoggedIn/savedUsername", "");
emailField.text = keepMeLoggedInCheckbox.checked ? savedUsername === "Unknown user" ? "" : savedUsername : ""; emailField.text = keepMeLoggedInCheckbox.checked ? savedUsername === "Unknown user" ? "" : savedUsername : "";
@ -144,7 +147,7 @@ Item {
Item { Item {
id: loginContainer id: loginContainer
width: displayNameField.width width: displayNameField.width
height: errorContainer.height + displayNameField.height + emailField.height + passwordField.height + 5.5 * hifi.dimensions.contentSpacing.y + height: errorContainer.height + loginDialogTextContainer.height + displayNameField.height + emailField.height + passwordField.height + 5.5 * hifi.dimensions.contentSpacing.y +
keepMeLoggedInCheckbox.height + loginButton.height + cantAccessTextMetrics.height + continueButton.height keepMeLoggedInCheckbox.height + loginButton.height + cantAccessTextMetrics.height + continueButton.height
anchors { anchors {
top: parent.top top: parent.top
@ -158,9 +161,10 @@ Item {
width: parent.width width: parent.width
height: loginErrorMessageTextMetrics.height height: loginErrorMessageTextMetrics.height
anchors { anchors {
bottom: displayNameField.top; bottom: loginDialogTextContainer.top
bottomMargin: hifi.dimensions.contentSpacing.y; bottomMargin: hifi.dimensions.contentSpacing.y
left: displayNameField.left; left: loginDialogTextContainer.left
right: loginDialogTextContainer.right
} }
TextMetrics { TextMetrics {
id: loginErrorMessageTextMetrics id: loginErrorMessageTextMetrics
@ -173,12 +177,45 @@ Item {
font.family: linkAccountBody.fontFamily font.family: linkAccountBody.fontFamily
font.pixelSize: linkAccountBody.textFieldFontSize font.pixelSize: linkAccountBody.textFieldFontSize
font.bold: linkAccountBody.fontBold font.bold: linkAccountBody.fontBold
anchors {
top: parent.top
left: parent.left
right: parent.right
}
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: "" text: ""
visible: false visible: false
} }
} }
Item {
id: loginDialogTextContainer
height: 56
anchors {
top: parent.top
left: parent.left
right: parent.right
topMargin: 1.5 * hifi.dimensions.contentSpacing.y
}
Text {
id: loginDialogText
text: qsTr("Log In")
lineHeight: 1
color: "white"
anchors {
top: parent.top
left: parent.left
right: parent.right
}
font.family: linkAccountBody.fontFamily
font.pixelSize: 24
font.bold: linkAccountBody.fontBold
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
HifiControlsUit.TextField { HifiControlsUit.TextField {
id: displayNameField id: displayNameField
@ -187,8 +224,8 @@ Item {
font.pixelSize: linkAccountBody.textFieldFontSize font.pixelSize: linkAccountBody.textFieldFontSize
styleRenderType: Text.QtRendering styleRenderType: Text.QtRendering
anchors { anchors {
top: parent.top top: loginDialogTextContainer.bottom
topMargin: errorContainer.height topMargin: 1.5 * hifi.dimensions.contentSpacing.y
} }
placeholderText: "Display Name (optional)" placeholderText: "Display Name (optional)"
activeFocusOnPress: true activeFocusOnPress: true
@ -352,6 +389,7 @@ Item {
labelFontFamily: linkAccountBody.fontFamily labelFontFamily: linkAccountBody.fontFamily
labelFontSize: 18; labelFontSize: 18;
color: hifi.colors.white; color: hifi.colors.white;
visible: !isLoggingInToDomain
anchors { anchors {
top: passwordField.bottom; top: passwordField.bottom;
topMargin: hifi.dimensions.contentSpacing.y; topMargin: hifi.dimensions.contentSpacing.y;
@ -436,7 +474,7 @@ Item {
font.pixelSize: linkAccountBody.textFieldFontSize font.pixelSize: linkAccountBody.textFieldFontSize
font.bold: linkAccountBody.fontBold font.bold: linkAccountBody.fontBold
text: "<a href='metaverse.vircadia.com/users/password/new'> Can't access your account?</a>" text: "<a href='https://metaverse.vircadia.com/users/password/new'> Can't access your account?</a>"
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
@ -562,7 +600,7 @@ Item {
leftMargin: hifi.dimensions.contentSpacing.x leftMargin: hifi.dimensions.contentSpacing.x
} }
text: "<a href='metaverse.vircadia.com/users/register'>Sign Up</a>" text: "<a href='https://metaverse.vircadia.com/users/register'>Sign Up</a>"
linkColor: hifi.colors.blueAccent linkColor: hifi.colors.blueAccent
onLinkActivated: { onLinkActivated: {

View file

@ -33,6 +33,7 @@ Item {
property bool linkOculus: linkOculus property bool linkOculus: linkOculus
property bool createOculus: createOculus property bool createOculus: createOculus
property bool isLoggingInToDomain: isLoggingInToDomain property bool isLoggingInToDomain: isLoggingInToDomain
property string domainLoginDomain: domainLoginDomain
property string displayName: "" property string displayName: ""
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp() readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
@ -109,7 +110,7 @@ Item {
loggingInText.text = "Logging in to Oculus"; loggingInText.text = "Logging in to Oculus";
loggingInText.x = loggingInHeader.width/2 - loggingInTextMetrics.width/2 + loggingInGlyphTextMetrics.width/2; loggingInText.x = loggingInHeader.width/2 - loggingInTextMetrics.width/2 + loggingInGlyphTextMetrics.width/2;
} else if (loggingInBody.isLoggingInToDomain) { } else if (loggingInBody.isLoggingInToDomain) {
loggingInText.text = "Logging in to Domain"; loggingInText.text = "Logging in to " + domainLoginDomain;
loggingInText.anchors.centerIn = loggingInHeader; loggingInText.anchors.centerIn = loggingInHeader;
} else { } else {
loggingInText.text = "Logging in"; loggingInText.text = "Logging in";

View file

@ -1355,7 +1355,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
auto domainAccountManager = DependencyManager::get<DomainAccountManager>(); auto domainAccountManager = DependencyManager::get<DomainAccountManager>();
connect(domainAccountManager.data(), &DomainAccountManager::authRequired, dialogsManager.data(), connect(domainAccountManager.data(), &DomainAccountManager::authRequired, dialogsManager.data(),
&DialogsManager::showDomainLoginDialog); &DialogsManager::showDomainLoginDialog);
connect(domainAccountManager.data(), &DomainAccountManager::loginComplete, this,
&Application::updateWindowTitle);
// ####### TODO: Connect any other signals from domainAccountManager. // ####### TODO: Connect any other signals from domainAccountManager.
@ -1582,7 +1584,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// Do not show login dialog if requested not to on the command line // Do not show login dialog if requested not to on the command line
QString hifiNoLoginCommandLineKey = QString("--").append(HIFI_NO_LOGIN_COMMAND_LINE_KEY); QString hifiNoLoginCommandLineKey = QString("--").append(HIFI_NO_LOGIN_COMMAND_LINE_KEY);
int index = arguments().indexOf(hifiNoLoginCommandLineKey); int index = arguments().indexOf(hifiNoLoginCommandLineKey);
if (index != -1) { if (index != -1 || _disableLoginScreen) {
resumeAfterLoginDialogActionTaken(); resumeAfterLoginDialogActionTaken();
return; return;
} }
@ -7079,20 +7081,23 @@ void Application::updateWindowTitle() const {
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
auto accountManager = DependencyManager::get<AccountManager>(); auto accountManager = DependencyManager::get<AccountManager>();
auto domainAccountManager = DependencyManager::get<DomainAccountManager>();
auto isInErrorState = nodeList->getDomainHandler().isInErrorState(); auto isInErrorState = nodeList->getDomainHandler().isInErrorState();
bool isMetaverseLoggedIn = accountManager->isLoggedIn();
bool isDomainLoggedIn = domainAccountManager->isLoggedIn();
QString authedDomain = domainAccountManager->getAuthedDomain();
QString buildVersion = " - Vircadia - " QString buildVersion = " - Vircadia - "
+ (BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable ? QString("Version") : QString("Build")) + (BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable ? QString("Version") : QString("Build"))
+ " " + applicationVersion(); + " " + applicationVersion();
// ####### TODO
QString loginStatus = accountManager->isLoggedIn() ? "" : " (NOT LOGGED IN)";
QString connectionStatus = isInErrorState ? " (ERROR CONNECTING)" : QString connectionStatus = isInErrorState ? " (ERROR CONNECTING)" :
nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED)"; nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED)";
QString username = accountManager->getAccountInfo().getUsername();
setCrashAnnotation("sentry[user][username]", username.toStdString()); QString metaverseUsername = accountManager->getAccountInfo().getUsername();
QString domainUsername = domainAccountManager->getUsername();
setCrashAnnotation("sentry[user][metaverseUsername]", metaverseUsername.toStdString());
QString currentPlaceName; QString currentPlaceName;
if (isServerlessMode()) { if (isServerlessMode()) {
@ -7108,8 +7113,24 @@ void Application::updateWindowTitle() const {
} }
} }
QString title = QString() + (!username.isEmpty() ? username + " @ " : QString()) QString metaverseDetails;
+ currentPlaceName + connectionStatus + loginStatus + buildVersion; if (isMetaverseLoggedIn) {
metaverseDetails = "Metaverse: Logged in as " + metaverseUsername;
} else {
metaverseDetails = "Metaverse: Not Logged In";
}
QString domainDetails;
if (currentPlaceName == authedDomain && isDomainLoggedIn) {
// ###### TODO
// domainDetails = "Domain: Logged in as " + domainUsername;
domainDetails = "Domain: Logged in as " + domainUsername;
} else {
domainDetails = "Domain: Not Logged In";
}
QString title = QString() + currentPlaceName + connectionStatus + " (" + metaverseDetails + ") (" + domainDetails + ")"
+ buildVersion;
#ifndef WIN32 #ifndef WIN32
// crashes with vs2013/win32 // crashes with vs2013/win32

View file

@ -733,6 +733,7 @@ private:
GraphicsEngine _graphicsEngine; GraphicsEngine _graphicsEngine;
void updateRenderArgs(float deltaTime); void updateRenderArgs(float deltaTime);
bool _disableLoginScreen { true };
Overlays _overlays; Overlays _overlays;
ApplicationOverlay _applicationOverlay; ApplicationOverlay _applicationOverlay;

View file

@ -9,6 +9,10 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
// For happ(ier) development of QML, use these two things:
// This forces QML files to be pulled from the source as you edit it: set environment variable HIFI_USE_SOURCE_TREE_RESOURCES=1
// Use this to live reload: DependencyManager::get<OffscreenUi>()->clearCache();
#include "Menu.h" #include "Menu.h"
#include <QDesktopServices> #include <QDesktopServices>
#include <QFileDialog> #include <QFileDialog>
@ -84,6 +88,13 @@ Menu::Menu() {
dialogsManager.data(), &DialogsManager::toggleLoginDialog); dialogsManager.data(), &DialogsManager::toggleLoginDialog);
} }
auto domainLogin = addActionToQMenuAndActionHash(fileMenu, "Domain: Log In");
connect(domainLogin, &QAction::triggered, [] {
auto dialogsManager = DependencyManager::get<DialogsManager>();
dialogsManager->setDomainLoginState();
dialogsManager->showDomainLoginDialog();
});
// File > Quit // File > Quit
addActionToQMenuAndActionHash(fileMenu, MenuOption::Quit, Qt::CTRL | Qt::Key_Q, qApp, SLOT(quit()), QAction::QuitRole); addActionToQMenuAndActionHash(fileMenu, MenuOption::Quit, Qt::CTRL | Qt::Key_Q, qApp, SLOT(quit()), QAction::QuitRole);

View file

@ -110,10 +110,21 @@ void DialogsManager::setDomainConnectionFailureVisibility(bool visible) {
} }
} }
void DialogsManager::setMetaverseLoginState() {
// We're only turning off the domain login trigger but the actual domain auth URL is still saved.
// So we can continue the domain login if desired.
_isDomainLogin = false;
}
void DialogsManager::setDomainLoginState() {
_isDomainLogin = true;
}
void DialogsManager::setDomainLogin(bool isDomainLogin, const QString& domain) { void DialogsManager::setDomainLogin(bool isDomainLogin, const QString& domain) {
_isDomainLogin = isDomainLogin; _isDomainLogin = isDomainLogin;
_domainLoginDomain = domain; if (!domain.isEmpty()) {
_domainLoginDomain = domain;
}
} }
void DialogsManager::toggleLoginDialog() { void DialogsManager::toggleLoginDialog() {

View file

@ -41,6 +41,8 @@ public:
QPointer<TestingDialog> getTestingDialog() const { return _testingDialog; } QPointer<TestingDialog> getTestingDialog() const { return _testingDialog; }
void emitAddressBarShown(bool visible) { emit addressBarShown(visible); } void emitAddressBarShown(bool visible) { emit addressBarShown(visible); }
void setAddressBarVisible(bool addressBarVisible); void setAddressBarVisible(bool addressBarVisible);
void setMetaverseLoginState();
void setDomainLoginState();
bool getIsDomainLogin() { return _isDomainLogin; } bool getIsDomainLogin() { return _isDomainLogin; }
QString getDomainLoginDomain() { return _domainLoginDomain; } QString getDomainLoginDomain() { return _domainLoginDomain; }
@ -52,7 +54,7 @@ public slots:
void toggleLoginDialog(); void toggleLoginDialog();
void showLoginDialog(); void showLoginDialog();
void hideLoginDialog(); void hideLoginDialog();
void showDomainLoginDialog(const QString& domain); void showDomainLoginDialog(const QString& domain = "");
void octreeStatsDetails(); void octreeStatsDetails();
void lodTools(); void lodTools();
void hmdTools(bool showTools); void hmdTools(bool showTools);

View file

@ -99,14 +99,16 @@ void LoginDialog::toggleAction() {
if (accountManager->isLoggedIn()) { if (accountManager->isLoggedIn()) {
// change the menu item to logout // change the menu item to logout
loginAction->setText("Logout " + accountManager->getAccountInfo().getUsername()); loginAction->setText("Metaverse: Logout " + accountManager->getAccountInfo().getUsername());
connection = connect(loginAction, &QAction::triggered, accountManager.data(), &AccountManager::logout); connection = connect(loginAction, &QAction::triggered, accountManager.data(), &AccountManager::logout);
} else { } else {
// change the menu item to login // change the menu item to login
loginAction->setText("Log In / Sign Up"); loginAction->setText("Metaverse: Log In / Sign Up");
connection = connect(loginAction, &QAction::triggered, [] { connection = connect(loginAction, &QAction::triggered, [] {
// if not in login state, show. // if not in login state, show.
if (!qApp->getLoginDialogPoppedUp()) { if (!qApp->getLoginDialogPoppedUp()) {
auto dialogsManager = DependencyManager::get<DialogsManager>();
dialogsManager->setMetaverseLoginState();
LoginDialog::showWithSelection(); LoginDialog::showWithSelection();
} }
}); });

View file

@ -18,7 +18,9 @@
#include <QtNetwork/QNetworkReply> #include <QtNetwork/QNetworkReply>
#include <SettingHandle.h> #include <SettingHandle.h>
#include <DependencyManager.h>
#include "NodeList.h"
#include "NetworkingConstants.h" #include "NetworkingConstants.h"
#include "NetworkLogging.h" #include "NetworkLogging.h"
#include "NetworkAccessManager.h" #include "NetworkAccessManager.h"
@ -101,6 +103,8 @@ void DomainAccountManager::requestAccessTokenFinished() {
// miniOrange plugin provides no scope. // miniOrange plugin provides no scope.
if (rootObject.contains("access_token")) { if (rootObject.contains("access_token")) {
// Success. // Success.
auto nodeList = DependencyManager::get<NodeList>();
_domain_name = nodeList->getDomainHandler().getHostname();
QUrl rootURL = requestReply->url(); QUrl rootURL = requestReply->url();
rootURL.setPath(""); rootURL.setPath("");
setTokensFromJSON(rootObject, rootURL); setTokensFromJSON(rootObject, rootURL);
@ -133,10 +137,12 @@ bool DomainAccountManager::accessTokenIsExpired() {
bool DomainAccountManager::hasValidAccessToken() { bool DomainAccountManager::hasValidAccessToken() {
QString currentDomainAccessToken = domainAccessToken.get(); // ###### TODO: wire this up to actually retrieve a token (based on session or storage) and confirm that it is in fact valid and relevant to the current domain.
// QString currentDomainAccessToken = domainAccessToken.get();
if (currentDomainAccessToken.isEmpty() || accessTokenIsExpired()) { QString currentDomainAccessToken = _access_token;
// if (currentDomainAccessToken.isEmpty() || accessTokenIsExpired()) {
if (currentDomainAccessToken.isEmpty()) {
if (VERBOSE_HTTP_REQUEST_DEBUGGING) { if (VERBOSE_HTTP_REQUEST_DEBUGGING) {
qCDebug(networking) << "An access token is required for requests to" qCDebug(networking) << "An access token is required for requests to"
<< qPrintable(_authURL.toString()); << qPrintable(_authURL.toString());
@ -153,23 +159,20 @@ bool DomainAccountManager::hasValidAccessToken() {
return true; return true;
} }
} }
void DomainAccountManager::setTokensFromJSON(const QJsonObject& jsonObject, const QUrl& url) { void DomainAccountManager::setTokensFromJSON(const QJsonObject& jsonObject, const QUrl& url) {
_access_token = jsonObject["access_token"].toString(); _access_token = jsonObject["access_token"].toString();
_refresh_token = jsonObject["refresh_token"].toString(); _refresh_token = jsonObject["refresh_token"].toString();
// ####### TODO: Enable and use these.
// ####### TODO: Protect these per AccountManager? // ####### TODO: Protect these per AccountManager?
// ######: TODO: clientID needed? // ######: TODO: clientID needed?
/*
qCDebug(networking) << "Storing a domain account with access-token for" << qPrintable(url.toString()); // qCDebug(networking) << "Storing a domain account with access-token for" << qPrintable(url.toString());
domainAccessToken.set(jsonObject["access_token"].toString()); // domainAccessToken.set(jsonObject["access_token"].toString());
domainAccessRefreshToken.set(jsonObject["refresh_token"].toString()); // domainAccessRefreshToken.set(jsonObject["refresh_token"].toString());
domainAccessTokenExpiresIn.set(QDateTime::currentMSecsSinceEpoch() + (jsonObject["expires_in"].toDouble() * 1000)); // domainAccessTokenExpiresIn.set(QDateTime::currentMSecsSinceEpoch() + (jsonObject["expires_in"].toDouble() * 1000));
domainAccessTokenType.set(jsonObject["token_type"].toString()); // domainAccessTokenType.set(jsonObject["token_type"].toString());
*/
} }
bool DomainAccountManager::checkAndSignalForAccessToken() { bool DomainAccountManager::checkAndSignalForAccessToken() {

View file

@ -29,6 +29,9 @@ public:
QString getUsername() { return _username; } QString getUsername() { return _username; }
QString getAccessToken() { return _access_token; } QString getAccessToken() { return _access_token; }
QString getRefreshToken() { return _refresh_token; } QString getRefreshToken() { return _refresh_token; }
QString getAuthedDomain() { return _domain_name; }
bool isLoggedIn() { return !_authURL.isEmpty() && hasValidAccessToken(); }
Q_INVOKABLE bool checkAndSignalForAccessToken(); Q_INVOKABLE bool checkAndSignalForAccessToken();
@ -57,6 +60,7 @@ private:
QString _username; // ####### TODO: Store elsewhere? QString _username; // ####### TODO: Store elsewhere?
QString _access_token; // ####... "" QString _access_token; // ####... ""
QString _refresh_token; // ####... "" QString _refresh_token; // ####... ""
QString _domain_name; //
}; };
#endif // hifi_DomainAccountManager_h #endif // hifi_DomainAccountManager_h