Skip to content

Commit 9689b9e

Browse files
committed
remove unnecessary webfinger query
1 parent 6e2aa70 commit 9689b9e

7 files changed

Lines changed: 14 additions & 193 deletions

src/gui/newwizard/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ target_sources(OpenCloudGui PRIVATE
3131
jobs/resolveurljobfactory.cpp
3232
jobs/resolveurljobfactory.h
3333

34-
jobs/discoverwebfingerservicejobfactory.cpp
35-
jobs/discoverwebfingerservicejobfactory.h
36-
3734
jobs/webfingeruserinfojobfactory.cpp
3835
jobs/webfingeruserinfojobfactory.h
3936

src/gui/newwizard/jobs/discoverwebfingerservicejobfactory.cpp

Lines changed: 0 additions & 101 deletions
This file was deleted.

src/gui/newwizard/jobs/discoverwebfingerservicejobfactory.h

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/gui/newwizard/setupwizardaccountbuilder.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,6 @@ QString SetupWizardAccountBuilder::syncTargetDir() const
156156
return _defaultSyncTargetDir;
157157
}
158158

159-
void SetupWizardAccountBuilder::setWebFingerAuthenticationServerUrl(const QUrl &url)
160-
{
161-
_webFingerAuthenticationServerUrl = url;
162-
}
163-
164-
QUrl SetupWizardAccountBuilder::webFingerAuthenticationServerUrl() const
165-
{
166-
return _webFingerAuthenticationServerUrl;
167-
}
168-
169159
void SetupWizardAccountBuilder::setWebFingerInstances(const QVector<QUrl> &instancesList)
170160
{
171161
_webFingerInstances = instancesList;

src/gui/newwizard/setupwizardaccountbuilder.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ class SetupWizardAccountBuilder
9595
*/
9696
AccountPtr build() const;
9797

98-
void setWebFingerAuthenticationServerUrl(const QUrl &url);
99-
QUrl webFingerAuthenticationServerUrl() const;
100-
10198
void setWebFingerInstances(const QVector<QUrl> &instancesList);
10299
QVector<QUrl> webFingerInstances() const;
103100

@@ -107,7 +104,6 @@ class SetupWizardAccountBuilder
107104
private:
108105
QUrl _serverUrl;
109106

110-
QUrl _webFingerAuthenticationServerUrl;
111107
QVector<QUrl> _webFingerInstances;
112108
QUrl _webFingerSelectedInstance;
113109

src/gui/newwizard/states/oauthcredentialssetupwizardstate.cpp

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@ namespace OCC::Wizard {
2121
OAuthCredentialsSetupWizardState::OAuthCredentialsSetupWizardState(SetupWizardContext *context)
2222
: AbstractSetupWizardState(context)
2323
{
24-
const auto authServerUrl = [this]() {
25-
auto authServerUrl = _context->accountBuilder().webFingerAuthenticationServerUrl();
26-
if (!authServerUrl.isEmpty()) {
27-
return authServerUrl;
28-
}
29-
return _context->accountBuilder().serverUrl();
30-
}();
31-
24+
const auto authServerUrl = _context->accountBuilder().serverUrl();
3225
auto oAuth = new OAuth(authServerUrl, _context->accessManager(), {}, this);
3326
_page = new OAuthCredentialsSetupWizardPage(oAuth, authServerUrl);
3427

@@ -59,33 +52,27 @@ OAuthCredentialsSetupWizardState::OAuthCredentialsSetupWizardState(SetupWizardCo
5952
}
6053
};
6154

62-
// SECOND WEBFINGER CALL (authenticated):
6355
// This discovers which OpenCloud instance(s) the authenticated user has access to.
6456
// Uses the OAuth bearer token and resource="acct:me@{host}".
6557
// Looking for: rel="http://webfinger.opencloud/rel/server-instance"
66-
// See issue #271 for why we perform WebFinger twice.
6758
// Backend WebFinger docs: https://github.com/opencloud-eu/opencloud/blob/main/services/webfinger/README.md
68-
if (!_context->accountBuilder().webFingerAuthenticationServerUrl().isEmpty()) {
69-
auto *job = Jobs::WebFingerInstanceLookupJobFactory(_context->accessManager(), token).startJob(_context->accountBuilder().serverUrl(), this);
59+
auto *job = Jobs::WebFingerInstanceLookupJobFactory(_context->accessManager(), token).startJob(_context->accountBuilder().serverUrl(), this);
7060

71-
connect(job, &CoreJob::finished, this, [finish, job, this]() {
72-
if (!job->success()) {
73-
Q_EMIT evaluationFailed(QStringLiteral("Failed to look up instances: %1").arg(job->errorMessage()));
74-
} else {
75-
const auto instanceUrls = qvariant_cast<QVector<QUrl>>(job->result());
61+
connect(job, &CoreJob::finished, this, [finish, job, this]() {
62+
if (!job->success()) {
63+
Q_EMIT evaluationFailed(QStringLiteral("Failed to look up instances: %1").arg(job->errorMessage()));
64+
} else {
65+
const auto instanceUrls = qvariant_cast<QVector<QUrl>>(job->result());
7666

77-
if (instanceUrls.isEmpty()) {
78-
Q_EMIT evaluationFailed(QStringLiteral("Server returned empty list of instances"));
79-
} else {
80-
_context->accountBuilder().setWebFingerInstances(instanceUrls);
81-
}
67+
if (instanceUrls.isEmpty()) {
68+
Q_EMIT evaluationFailed(QStringLiteral("Server returned empty list of instances"));
69+
} else {
70+
_context->accountBuilder().setWebFingerInstances(instanceUrls);
8271
}
72+
}
8373

84-
finish();
85-
});
86-
} else {
8774
finish();
88-
}
75+
});
8976
});
9077

9178
// the implementation moves to the next state automatically once ready, no user interaction needed

src/gui/newwizard/states/serverurlsetupwizardstate.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include "gui/newwizard/states/serverurlsetupwizardstate.h"
1616

17-
#include "gui/newwizard/jobs/discoverwebfingerservicejobfactory.h"
1817
#include "gui/newwizard/jobs/resolveurljobfactory.h"
1918
#include "gui/newwizard/pages/serverurlsetupwizardpage.h"
2019
#include "libsync/theme.h"
@@ -68,23 +67,7 @@ void ServerUrlSetupWizardState::evaluatePage()
6867
}
6968
_context->accountBuilder().setServerUrl(resolveJob->result().toUrl());
7069

71-
// FIRST WEBFINGER CALL (unauthenticated):
72-
// This discovers if the server supports WebFinger-based authentication
73-
// and finds the IdP URL. The resource parameter is the server URL itself.
74-
// Looking for: rel="http://openid.net/specs/connect/1.0/issuer"
75-
// See issue #271 for why we perform WebFinger twice.
76-
// Backend WebFinger docs: https://github.com/opencloud-eu/opencloud/blob/main/services/webfinger/README.md
77-
auto *checkWebFingerAuthJob =
78-
Jobs::DiscoverWebFingerServiceJobFactory(_context->accessManager()).startJob(_context->accountBuilder().serverUrl(), this);
79-
connect(checkWebFingerAuthJob, &CoreJob::finished, this, [checkWebFingerAuthJob, this]() {
80-
// in case any kind of error occurs, we assume the WebFinger service is not available
81-
if (!checkWebFingerAuthJob->success()) {
82-
Q_EMIT evaluationSuccessful();
83-
} else {
84-
_context->accountBuilder().setWebFingerAuthenticationServerUrl(checkWebFingerAuthJob->result().toUrl());
85-
Q_EMIT evaluationSuccessful();
86-
}
87-
});
70+
Q_EMIT evaluationSuccessful();
8871
});
8972

9073
connect(

0 commit comments

Comments
 (0)