]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(dav): fallback realm for HTTP authentication 43796/head
authorMichaIng <micha@dietpi.com>
Fri, 22 Dec 2023 03:10:07 +0000 (04:10 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Fri, 23 Feb 2024 20:29:43 +0000 (20:29 +0000)
By default, the name of the Nextcloud instance is an empty string, until changed by the admin. This leads to an empty realm sent with the WWW-Authenticate header, while the realm is mandatory for Basic HTTP authentication. Some clients have issues with an empty realm, e.g. Thunderbird cannot store passwords in this case.

This commit applies "Nextcloud" as fallback for the realm, in case the name of the Nextcloud instance is not set.

Solves: https://help.nextcloud.com/t/thunderbird-dont-save-caldav-password-because-of-missing-httprealm-or-formsubmiturl/93233

Signed-off-by: MichaIng <micha@dietpi.com>
apps/dav/lib/Connector/PublicAuth.php
apps/dav/lib/Connector/Sabre/Auth.php
apps/dav/lib/Connector/Sabre/BearerAuth.php

index d613a5a188f1b54d3819655389028ef632e3d323..65b20ca661ab2357615c88f021ea746bb4677a53 100644 (file)
@@ -61,7 +61,7 @@ class PublicAuth extends AbstractBasic {
 
                // setup realm
                $defaults = new \OCP\Defaults();
-               $this->realm = $defaults->getName();
+               $this->realm = $defaults->getName() ?: 'Nextcloud';
        }
 
        /**
index 243b92e63f744ac95361a429285e684232b31734..c2e343d8656f1c6a50d5d049c01a6e8a14efc6e9 100644 (file)
@@ -75,7 +75,7 @@ class Auth extends AbstractBasic {
 
                // setup realm
                $defaults = new \OCP\Defaults();
-               $this->realm = $defaults->getName();
+               $this->realm = $defaults->getName() ?: 'Nextcloud';
        }
 
        /**
index 4d9599b97a3da0aecd11daeb959ffc220f897080..6fd61c44b3452c15f7e8a059839c45d7db268933 100644 (file)
@@ -47,7 +47,7 @@ class BearerAuth extends AbstractBearer {
 
                // setup realm
                $defaults = new \OCP\Defaults();
-               $this->realm = $defaults->getName();
+               $this->realm = $defaults->getName() ?: 'Nextcloud';
        }
 
        private function setupUserFs($userId) {