initial pass at using keypairs for username verification for basic domain-server ACL
Showing the changes to interface/src/Application.cpp (1 of 35 files). Show all
Unified · Split
| @@ -72,7 +72,6 @@ · 71 unmodified lines | |||
| 72 | #include "InterfaceVersion.h" | 72 | #include "InterfaceVersion.h" |
| 73 | #include "Menu.h" | 73 | #include "Menu.h" |
| 74 | #include "ModelUploader.h" | 74 | #include "ModelUploader.h" |
| 75 | #include "PaymentManager.h" | ||
| 76 | #include "Util.h" | 75 | #include "Util.h" |
| 77 | #include "devices/MIDIManager.h" | 76 | #include "devices/MIDIManager.h" |
| 78 | #include "devices/OculusManager.h" | 77 | #include "devices/OculusManager.h" |
| @@ -90,7 +89,6 @@ · 11 unmodified lines | |||
| 90 | #include "scripting/WindowScriptingInterface.h" | 89 | #include "scripting/WindowScriptingInterface.h" |
| 91 | 90 | ||
| 92 | #include "ui/InfoView.h" | 91 | #include "ui/InfoView.h" |
| 93 | #include "ui/OAuthWebViewHandler.h" | ||
| 94 | #include "ui/Snapshot.h" | 92 | #include "ui/Snapshot.h" |
| 95 | #include "ui/Stats.h" | 93 | #include "ui/Stats.h" |
| 96 | #include "ui/TextRenderer.h" | 94 | #include "ui/TextRenderer.h" |
| @@ -220,10 +218,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 123 unmodified lines | |||
| 220 | listenPort = atoi(portStr); | 218 | listenPort = atoi(portStr); |
| 221 | } | 219 | } |
| 222 | 220 | ||
| 223 | // call the OAuthWebviewHandler static getter so that its instance lives in our thread | ||
| 224 | // make sure it is ready before the NodeList might need it | ||
| 225 | OAuthWebViewHandler::getInstance(); | ||
| 226 | |||
| 227 | // start the nodeThread so its event loop is running | 221 | // start the nodeThread so its event loop is running |
| 228 | _nodeThread->start(); | 222 | _nodeThread->start(); |
| 229 | 223 | ||
| @@ -256,11 +250,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 26 unmodified lines | |||
| 256 | connect(&domainHandler, &DomainHandler::settingsReceived, this, &Application::domainSettingsReceived); | 250 | connect(&domainHandler, &DomainHandler::settingsReceived, this, &Application::domainSettingsReceived); |
| 257 | connect(&domainHandler, &DomainHandler::hostnameChanged, Menu::getInstance(), &Menu::clearLoginDialogDisplayedFlag); | 251 | connect(&domainHandler, &DomainHandler::hostnameChanged, Menu::getInstance(), &Menu::clearLoginDialogDisplayedFlag); |
| 258 | 252 | ||
| 259 | // hookup VoxelEditSender to PaymentManager so we can pay for octree edits | ||
| 260 | const PaymentManager& paymentManager = PaymentManager::getInstance(); | ||
| 261 | connect(&_voxelEditSender, &VoxelEditPacketSender::octreePaymentRequired, | ||
| 262 | &paymentManager, &PaymentManager::sendSignedPayment); | ||
| 263 | |||
| 264 | // update our location every 5 seconds in the data-server, assuming that we are authenticated with one | 253 | // update our location every 5 seconds in the data-server, assuming that we are authenticated with one |
| 265 | const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * 1000; | 254 | const qint64 DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS = 5 * 1000; |
| 266 | 255 | ||
| @@ -3483,7 +3472,7 @@ void Application::updateLocationInServer() { · 3216 unmodified lines | |||
| 3483 | 3472 | ||
| 3484 | rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject); | 3473 | rootObject.insert(LOCATION_KEY_IN_ROOT, locationObject); |
| 3485 | 3474 | ||
| 3486 | accountManager.authenticatedRequest("/api/v1/users/location", QNetworkAccessManager::PutOperation, | 3475 | accountManager.authenticatedRequest("/api/v1/user/location", QNetworkAccessManager::PutOperation, |
| 3487 | JSONCallbackParameters(), QJsonDocument(rootObject).toJson()); | 3476 | JSONCallbackParameters(), QJsonDocument(rootObject).toJson()); |
| 3488 | } | 3477 | } |
| 3489 | } | 3478 | } |
| @@ -3526,20 +3515,18 @@ void Application::domainChanged(const QString& domainHostname) { · 36 unmodified lines | |||
| 3526 | 3515 | ||
| 3527 | // reset the voxels renderer | 3516 | // reset the voxels renderer |
| 3528 | _voxels.killLocalVoxels(); | 3517 | _voxels.killLocalVoxels(); |
| 3529 | |||
| 3530 | // reset the auth URL for OAuth web view handler | ||
| 3531 | OAuthWebViewHandler::getInstance().clearLastAuthorizationURL(); | ||
| 3532 | } | 3518 | } |
| 3533 | 3519 | ||
| 3534 | void Application::connectedToDomain(const QString& hostname) { | 3520 | void Application::connectedToDomain(const QString& hostname) { |
| 3535 | AccountManager& accountManager = AccountManager::getInstance(); | 3521 | AccountManager& accountManager = AccountManager::getInstance(); |
| 3522 | const QUuid& domainID = NodeList::getInstance()->getDomainHandler().getUUID(); | ||
| 3523 | |||
| 3524 | if (accountManager.isLoggedIn() && !domainID.isNull()) { | ||
| 3525 | // update our data-server with the domain-server we're logged in with | ||
| 3536 | 3526 | ||
| 3537 | if (accountManager.isLoggedIn()) { | 3527 | QString domainPutJsonString = "{\"location\":{\"domain_id\":\"" + uuidStringWithoutCurlyBraces(domainID) + "\"}}"; |
| 3538 | // update our domain-server with the data-server we're logged in with | ||
| 3539 | |||
| 3540 | QString domainPutJsonString = "{\"address\":{\"domain\":\"" + hostname + "\"}}"; | ||
| 3541 | 3528 | ||
| 3542 | accountManager.authenticatedRequest("/api/v1/users/address", QNetworkAccessManager::PutOperation, | 3529 | accountManager.authenticatedRequest("/api/v1/user/location", QNetworkAccessManager::PutOperation, |
| 3543 | JSONCallbackParameters(), domainPutJsonString.toUtf8()); | 3530 | JSONCallbackParameters(), domainPutJsonString.toUtf8()); |
| 3544 | } | 3531 | } |
| 3545 | } | 3532 | } |