@@ -21,14 +21,7 @@ namespace OCC::Wizard {
2121OAuthCredentialsSetupWizardState::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
0 commit comments