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",
"label": "Networking / Authentication",
"label": "Networking / WordPress OAuth2",
"settings": [
{
"name": "enable_oauth2",
"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,
"type": "checkbox",
"advanced": true

View file

@ -29,6 +29,7 @@
#include "OctreeStatsDialog.h"
#include "PreferencesDialog.h"
#include "UpdateDialog.h"
#include "DomainHandler.h"
#include "scripting/HMDScriptingInterface.h"
@ -130,15 +131,19 @@ void DialogsManager::hideLoginDialog() {
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;
LoginDialog::showWithSelection();
}
// #######: TODO: Domain version of toggleLoginDialog()?
// #######: TODO: Domain version of hiadLoginDialog()?
void DialogsManager::showUpdateDialog() {
UpdateDialog::show();
}

View file

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

View file

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