Skip to content

Commit

Permalink
fix(dav): fallback realm for HTTP authentication
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
MichaIng committed Feb 14, 2024
1 parent de4e483 commit 91127ed
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/LegacyPublicAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct(IRequest $request,

// setup realm
$defaults = new \OCP\Defaults();
$this->realm = $defaults->getName();
$this->realm = $defaults->getName() ?: 'Nextcloud';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __construct(ISession $session,

// setup realm
$defaults = new \OCP\Defaults();
$this->realm = $defaults->getName();
$this->realm = $defaults->getName() ?: 'Nextcloud';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/BearerAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(IUserSession $userSession,

// setup realm
$defaults = new \OCP\Defaults();
$this->realm = $defaults->getName();
$this->realm = $defaults->getName() ?: 'Nextcloud';
}

private function setupUserFs($userId) {
Expand Down

0 comments on commit 91127ed

Please sign in to comment.