Skip to content

PublicCapabilities: desktoplogin is hardcoded to 1, should be configurable #194

Description

@n-iv

Description

The desktoplogin value in lib/PublicCapabilities.php is hardcoded to 1:

'desktoplogin' => 1,

This prevents the Nextcloud desktop client from using the standard OIDC login flow (via user_oidc) on GSS slave nodes. When desktoplogin is 1, the desktop client's WebView opens /index.php/login/flow, but the OIDC authentication callback never produces the nc://login/server:...&user:...&password:... URL that the client expects.

Steps to reproduce

  1. Configure a GSS slave node with globalsiteselector 2.7.0 enabled
  2. Enable user_oidc 8.8.0 on the same node with a working OIDC provider (e.g. Keycloak)
  3. Confirm that OIDC login works fine in a web browser
  4. Try to add the account in the Nextcloud desktop client (tested with 4.0.7, Qt 6.10.2)
  5. In the WebView, authenticate via OIDC/FIM

Expected: The OIDC flow completes and the desktop client receives credentials via nc:// callback
Actual: The WebView stays open after OIDC authentication completes. No nc:// callback is triggered. The client log shows:

Auth type for QUrl("https://slave.example.com/remote.php/dav/files//") is OCC::DetermineAuthTypeJob::WebViewFlow
Url to auth at: "https://slave.example.com/index.php/login/flow"

The globalscale capability returned to the client is:

{"enabled": true, "desktoplogin": 1, "token": "xxxxx"}

Workaround

Manually patch lib/PublicCapabilities.php to set desktoplogin to 0. This makes the desktop client fall back to the standard OIDC login flow, which works correctly.

Proposed fix

Inject IAppConfig and read the value from app config instead of hardcoding it:

--- a/lib/PublicCapabilities.php
+++ b/lib/PublicCapabilities.php
@@ -10,17 +10,19 @@

 use OCA\GlobalSiteSelector\Service\GlobalScaleService;
 use OCP\Capabilities\IPublicCapability;
+use OCP\IAppConfig;

 class PublicCapabilities implements IPublicCapability {
 	public function __construct(
 		private readonly GlobalScaleService $globalScaleService,
+		private readonly IAppConfig $appConfig,
 	) {

 	}
 	public function getCapabilities(): array {
 		return [
 			'globalscale' => [
 				'enabled' => true,
-				'desktoplogin' => 1,
+				'desktoplogin' => $this->appConfig->getValueInt('globalsiteselector', 'desktoplogin', 1),
 				'token' => $this->globalScaleService->getLocalToken(),
 			]
 		];

This allows administrators to control the behavior via:

occ config:app:set globalsiteselector desktoplogin --value=0

Environment

  • Nextcloud Server: 32.0.6 Enterprise
  • Global Site Selector: 2.7.0
  • user_oidc: 8.8.0
  • Desktop client: 4.0.7 (Qt 6.10.2, Linux)
  • OIDC Provider: Keycloak

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions