Project

General

Profile

Freedom Issue #2107 » auth.patch

theova, 2019-04-27 10:37 AM

View differences:

desktop-2.5.2/src/CMakeLists.txt 2019-04-22 04:01:31.260028906 +0000
4 4
set(synclib_NAME ${APPLICATION_EXECUTABLE}sync)
5
find_package(Qt5 5.6 COMPONENTS Core Network Xml Concurrent WebEngineWidgets WebEngine REQUIRED)
5
find_package(Qt5 5.6 COMPONENTS Core Network Xml Concurrent REQUIRED)
6 6
if (Qt5Core_VERSION VERSION_LESS 5.9.0)
7 7
message(STATUS "For HTTP/2 support, compile with Qt 5.9 or higher.")
8 8
endif()
9
-- desktop-2.5.2/src/gui/CMakeLists.txt	2019-03-19 01:52:24.000000000 +0000
9
++ desktop-2.5.2/src/gui/CMakeLists.txt	2019-04-22 04:15:53.230034980 +0000
......
40 40
    wizard/owncloudoauthcredspage.ui
41 41
    wizard/owncloudsetupnocredspage.ui
42 42
    wizard/owncloudwizardresultpage.ui
43
    wizard/webview.ui
44 43
)
45 44
set(client_SRCS
......
103 102
    creds/credentialsfactory.cpp
104 103
    creds/httpcredentialsgui.cpp
105 104
    creds/oauth.cpp
106
    creds/webflowcredentials.cpp
107
    creds/webflowcredentialsdialog.cpp
108 105
    wizard/postfixlineedit.cpp
109 106
    wizard/abstractcredswizardpage.cpp
110 107
    wizard/owncloudadvancedsetuppage.cpp
......
115 112
    wizard/owncloudwizardcommon.cpp
116 113
    wizard/owncloudwizard.cpp
117 114
    wizard/owncloudwizardresultpage.cpp
118
    wizard/webviewpage.cpp
119
    wizard/webview.cpp
120 115
    wizard/slideshow.cpp
121 116
)
......
295 290
endif()
296 291
add_library(updater STATIC ${updater_SRCS})
297
target_link_libraries(updater ${synclib_NAME} Qt5::Widgets Qt5::Network Qt5::Xml Qt5::WebEngineWidgets)
292
target_link_libraries(updater ${synclib_NAME} Qt5::Widgets Qt5::Network Qt5::Xml)
298 293
target_include_directories(updater PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
299 294
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
300
-- desktop-2.5.2/src/gui/accountmanager.cpp	2019-03-19 01:52:24.000000000 +0000
295
++ desktop-2.5.2/src/gui/accountmanager.cpp	2019-04-22 04:17:04.440035482 +0000
......
253 253
        acc->setUrl(urlConfig.toUrl());
254 254
    }
255
    // Migrate to webflow
256
    if (authType == QLatin1String("http")) {
257
        authType = "webflow";
258
        settings.setValue(QLatin1String(authTypeC), authType);
259

  
260
        foreach(QString key, settings.childKeys()) {
261
            if (!key.startsWith("http_"))
262
                continue;
263
            auto newkey = QString::fromLatin1("webflow_").append(key.mid(5));
264
            settings.setValue(newkey, settings.value((key)));
265
            settings.remove(key);
266
        }
267
    }
268

  
269 255
    qCInfo(lcAccountManager) << "Account for" << acc->url() << "using auth type" << authType;
270 256
    acc->_serverVersion = settings.value(QLatin1String(serverVersionC)).toString();
271
-- desktop-2.5.2/src/gui/creds/credentialsfactory.cpp	2019-03-19 01:52:24.000000000 +0000
257
++ desktop-2.5.2/src/gui/creds/credentialsfactory.cpp	2019-04-22 04:23:19.590038126 +0000
......
21 21
#ifndef NO_SHIBBOLETH
22 22
#include "creds/shibbolethcredentials.h"
23 23
#endif
24
#include "creds/webflowcredentials.h"
25 24
namespace OCC {
......
40 39
        } else if (type == "shibboleth") {
41 40
            return new ShibbolethCredentials;
42 41
#endif
43
        } else if (type == "webflow") {
44
            return new WebFlowCredentials;
45 42
        } else {
46 43
            qCWarning(lcGuiCredentials, "Unknown credentials type: %s", qPrintable(type));
47 44
            return new DummyCredentials;
48
-- desktop-2.5.2/src/gui/wizard/owncloudwizard.cpp	2019-03-19 01:52:24.000000000 +0000
45
++ desktop-2.5.2/src/gui/wizard/owncloudwizard.cpp	2019-04-22 04:24:59.360038829 +0000
......
26 26
#endif
27 27
#include "wizard/owncloudadvancedsetuppage.h"
28 28
#include "wizard/owncloudwizardresultpage.h"
29
#include "wizard/webviewpage.h"
30 29
#include "QProgressIndicator.h"
......
51 50
    , _advancedSetupPage(new OwncloudAdvancedSetupPage)
52 51
    , _resultPage(new OwncloudWizardResultPage)
53 52
    , _credentialsPage(nullptr)
54
    , _webViewPage(new WebViewPage(this))
55 53
    , _setupLog()
56 54
    , _registration(false)
57 55
{
......
64 62
#endif
65 63
    setPage(WizardCommon::Page_AdvancedSetup, _advancedSetupPage);
66 64
    setPage(WizardCommon::Page_Result, _resultPage);
67
    setPage(WizardCommon::Page_WebView, _webViewPage);
68 65
    connect(this, &QDialog::finished, this, &OwncloudWizard::basicSetupFinished);
......
79 76
#ifndef NO_SHIBBOLETH
80 77
    connect(_shibbolethCredsPage, &OwncloudShibbolethCredsPage::connectToOCUrl, this, &OwncloudWizard::connectToOCUrl);
81 78
#endif
82
    connect(_webViewPage, &WebViewPage::connectToOCUrl, this, &OwncloudWizard::connectToOCUrl);
83 79
    connect(_advancedSetupPage, &OwncloudAdvancedSetupPage::createLocalAndRemoteFolders,
84 80
        this, &OwncloudWizard::createLocalAndRemoteFolders);
85 81
    connect(this, &QWizard::customButtonClicked, this, &OwncloudWizard::skipFolderConfiguration);
......
168 164
        break;
169 165
#endif
170
    case WizardCommon::Page_WebView:
171
        _webViewPage->setConnected();
172
        break;
173

  
174 166
    case WizardCommon::Page_AdvancedSetup:
175 167
        _advancedSetupPage->directoriesCreated();
176 168
        break;
......
195 187
#endif
196 188
        if (type == DetermineAuthTypeJob::OAuth) {
197 189
        _credentialsPage = _browserCredsPage;
198
    } else if (type == DetermineAuthTypeJob::WebViewFlow) {
199
        _credentialsPage = _webViewPage;
200 190
    } else { // try Basic auth even for "Unknown"
201 191
        _credentialsPage = _httpCredsPage;
202 192
    }
203
-- desktop-2.5.2/src/libsync/networkjobs.h	2019-03-19 01:52:24.000000000 +0000
193
++ desktop-2.5.2/src/libsync/networkjobs.h	2019-04-22 05:21:11.950062594 +0000
......
411 411
    enum AuthType {
412 412
        Basic, // also the catch-all fallback for backwards compatibility reasons
413 413
        OAuth,
414
        Shibboleth,
415
        WebViewFlow
414
        Shibboleth
416 415
    };
417 416
    explicit DetermineAuthTypeJob(AccountPtr account, QObject *parent = nullptr);
418
-- desktop-2.5.2/src/libsync/networkjobs.cpp	2019-03-19 01:52:24.000000000 +0000
417
++ desktop-2.5.2/src/libsync/networkjobs.cpp	2019-04-22 05:33:28.590067785 +0000
......
922 922
    // WebViewFlow > OAuth > Shib > Basic
923 923
    if (_account->serverVersionInt() >= Account::makeServerVersion(12, 0, 0)) {
924
        result = WebViewFlow;
924
        result = Basic;
925 925
    }
926 926
    qCInfo(lcDetermineAuthTypeJob) << "Auth type for" << _account->davUrl() << "is" << result;
927
-- desktop-2.5.2/src/gui/wizard/owncloudsetuppage.cpp	2019-03-19 01:52:24.000000000 +0000
927
++ desktop-2.5.2/src/gui/wizard/owncloudsetuppage.cpp	2019-04-22 05:32:01.750067173 +0000
......
143 143
void OwncloudSetupPage::slotGotoProviderList()
144 144
{
145 145
    _ocWizard->setRegistration(true);
146
    _ocWizard->setAuthType(DetermineAuthTypeJob::AuthType::WebViewFlow);
146
    _ocWizard->setAuthType(DetermineAuthTypeJob::AuthType::Basic);
147 147
    _authTypeKnown = true;
148 148
    _checking = false;
149 149
    emit completeChanged();
......
260 260
        return WizardCommon::Page_OAuthCreds;
261 261
    case DetermineAuthTypeJob::Shibboleth:
262 262
        return WizardCommon::Page_ShibbolethCreds;
263
    case DetermineAuthTypeJob::WebViewFlow:
264
        return WizardCommon::Page_WebView;
265 263
    }
266 264
    return WizardCommon::Page_HttpCreds;
267 265
}
268
-- desktop-2.5.2/src/gui/wizard/owncloudwizard.h	2019-03-18 21:52:24.000000000 -0400
266
++ desktop-2.5.2/src/gui/wizard/owncloudwizard.h	2019-04-22 02:07:03.600081984 -0400
......
39 39
class OwncloudWizardResultPage;
40 40
class AbstractCredentials;
41 41
class AbstractCredentialsWizardPage;
42
class WebViewPage;
43 42
/**
44 43
 * @brief The OwncloudWizard class
......
106 105
    OwncloudAdvancedSetupPage *_advancedSetupPage;
107 106
    OwncloudWizardResultPage *_resultPage;
108 107
    AbstractCredentialsWizardPage *_credentialsPage;
109
    WebViewPage *_webViewPage;
110 108
    QStringList _setupLog;
(1-1/4)