Further complete the loop.

This commit is contained in:
Kasen IO 2020-07-30 00:34:02 -04:00
parent 5706a42b56
commit af34536a09
4 changed files with 15 additions and 10 deletions

View file

@ -59,12 +59,12 @@
}, },
{ {
"name": "authentication", "name": "authentication",
"label": "Networking / Authentication", "label": "Networking / WordPress OAuth2",
"settings": [ "settings": [
{ {
"name": "enable_oauth2", "name": "enable_oauth2",
"label": "Enable OAuth2 Authentication", "label": "Enable OAuth2 Authentication",
"help": "Allow a WordPress-based OAuth2 service to assign users to groups based on their role with the service.", "help": "Allow a WordPress-based (miniOrange) OAuth2 service to assign users to groups based on their role with the service.",
"default": false, "default": false,
"type": "checkbox", "type": "checkbox",
"advanced": true "advanced": true

View file

@ -29,6 +29,7 @@
#include "OctreeStatsDialog.h" #include "OctreeStatsDialog.h"
#include "PreferencesDialog.h" #include "PreferencesDialog.h"
#include "UpdateDialog.h" #include "UpdateDialog.h"
#include "DomainHandler.h"
#include "scripting/HMDScriptingInterface.h" #include "scripting/HMDScriptingInterface.h"
@ -130,15 +131,19 @@ void DialogsManager::hideLoginDialog() {
void DialogsManager::showDomainLoginDialog() { void DialogsManager::showDomainLoginDialog() {
const QJsonObject& settingsObject = DependencyManager::get<NodeList>()->getDomainHandler().getSettingsObject();
static const QString WP_OAUTH2_SERVER_URL = "authentication_oauth2_url_base";
if (!settingsObject.contains(WP_OAUTH2_SERVER_URL)) {
qDebug() << "Cannot log in to domain because an OAuth2 authorization was required but no authorization server was given.";
return;
}
_domainLoginAuthProvider = settingsObject[WP_OAUTH2_SERVER_URL].toString();
_isDomainLogin = true; _isDomainLogin = true;
LoginDialog::showWithSelection(); LoginDialog::showWithSelection();
} }
// #######: TODO: Domain version of toggleLoginDialog()?
// #######: TODO: Domain version of hiadLoginDialog()?
void DialogsManager::showUpdateDialog() { void DialogsManager::showUpdateDialog() {
UpdateDialog::show(); UpdateDialog::show();
} }

View file

@ -42,6 +42,7 @@ public:
void emitAddressBarShown(bool visible) { emit addressBarShown(visible); } void emitAddressBarShown(bool visible) { emit addressBarShown(visible); }
void setAddressBarVisible(bool addressBarVisible); void setAddressBarVisible(bool addressBarVisible);
bool getIsDomainLogin() { return _isDomainLogin; } bool getIsDomainLogin() { return _isDomainLogin; }
QString getDomainLoginAuthProvider() { return _domainLoginAuthProvider; }
public slots: public slots:
void showAddressBar(); void showAddressBar();
@ -87,6 +88,7 @@ private:
bool _addressBarVisible { false }; bool _addressBarVisible { false };
bool _isDomainLogin { false }; bool _isDomainLogin { false };
QString _domainLoginAuthProvider { "" };
}; };
#endif // hifi_DialogsManager_h #endif // hifi_DialogsManager_h

View file

@ -428,8 +428,6 @@ bool LoginDialog::getDomainLoginRequested() const {
return DependencyManager::get<DialogsManager>()->getIsDomainLogin(); return DependencyManager::get<DialogsManager>()->getIsDomainLogin();
} }
// ####### TODO: This method may not be necessary.
QString LoginDialog::getDomainLoginAuthProvider() const { QString LoginDialog::getDomainLoginAuthProvider() const {
// ####### TODO return DependencyManager::get<DialogsManager>()->getDomainLoginAuthProvider();
return QString("https://example.com/oauth2");
} }