From 7f3761481cf7088d04867cf6abc6421a2ebc60a0 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 21 Mar 2016 15:22:32 -0700 Subject: [PATCH] don't store UUIDs for cookies on disk --- domain-server/src/DomainServer.cpp | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 374fbd5407..fb67e71c59 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -103,8 +103,6 @@ DomainServer::DomainServer(int argc, char* argv[]) : qDebug() << "Setting up LimitedNodeList and assignments."; setupNodeListAndAssignments(); - loadExistingSessionsFromSettings(); - // setup automatic networking settings with data server setupAutomaticNetworking(); @@ -1647,10 +1645,11 @@ bool DomainServer::isAuthenticatedRequest(HTTPConnection* connection, const QUrl // add it to the set so we can handle the callback from the OAuth provider _webAuthenticationStateSet.insert(stateUUID); - QUrl oauthRedirectURL = oauthAuthorizationURL(stateUUID); + QUrl authURL = oauthAuthorizationURL(stateUUID); Headers redirectHeaders; - redirectHeaders.insert("Location", oauthRedirectURL.toEncoded()); + + redirectHeaders.insert("Location", authURL.toEncoded()); connection->respond(HTTPConnection::StatusCode302, QByteArray(), HTTPConnection::DefaultContentType, redirectHeaders); @@ -1728,7 +1727,6 @@ QNetworkReply* DomainServer::profileRequestGivenTokenReply(QNetworkReply* tokenR return NetworkAccessManager::getInstance().get(profileRequest); } -const QString DS_SETTINGS_SESSIONS_GROUP = "web-sessions"; Headers DomainServer::setupCookieHeadersFromProfileReply(QNetworkReply* profileReply) { Headers cookieHeaders; @@ -1742,10 +1740,6 @@ Headers DomainServer::setupCookieHeadersFromProfileReply(QNetworkReply* profileR DomainServerWebSessionData sessionData(userObject); _cookieSessionHash.insert(cookieUUID, sessionData); - // persist the cookie to settings file so we can get it back on DS relaunch - QStringList path = QStringList() << DS_SETTINGS_SESSIONS_GROUP << cookieUUID.toString(); - Setting::Handle(path).set(QVariant::fromValue(sessionData)); - // setup expiry for cookie to 1 month from today QDateTime cookieExpiry = QDateTime::currentDateTimeUtc().addMonths(1); @@ -1762,18 +1756,6 @@ Headers DomainServer::setupCookieHeadersFromProfileReply(QNetworkReply* profileR return cookieHeaders; } -void DomainServer::loadExistingSessionsFromSettings() { - // read data for existing web sessions into memory so existing sessions can be leveraged - Settings domainServerSettings; - domainServerSettings.beginGroup(DS_SETTINGS_SESSIONS_GROUP); - - foreach(const QString& uuidKey, domainServerSettings.childKeys()) { - _cookieSessionHash.insert(QUuid(uuidKey), - domainServerSettings.value(uuidKey).value()); - qDebug() << "Pulled web session from settings - cookie UUID is" << uuidKey; - } -} - void DomainServer::refreshStaticAssignmentAndAddToQueue(SharedAssignmentPointer& assignment) { QUuid oldUUID = assignment->getUUID(); assignment->resetUUID();