From 05c7477709c377245ad3da998b410496ffca60fc Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Tue, 14 Jul 2026 11:14:15 +0200 Subject: [PATCH] fix: Return a logout URL even when SAML SLO is not configured Signed-off-by: Carl Schwan --- core/AppInfo/Application.php | 1 - lib/private/NavigationManager.php | 20 +++++++++----------- lib/private/legacy/OC_User.php | 7 +++++-- lib/public/Authentication/IApacheBackend.php | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/core/AppInfo/Application.php b/core/AppInfo/Application.php index 599ab4ddda427..6d55bfb7c0299 100644 --- a/core/AppInfo/Application.php +++ b/core/AppInfo/Application.php @@ -93,5 +93,4 @@ public function register(IRegistrationContext $context): void { public function boot(IBootContext $context): void { // ... } - } diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index d6ddb6866dd57..b545cb879debe 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -309,17 +309,15 @@ private function init(bool $resolveClosures = true): void { } $logoutUrl = \OC_User::getLogoutUrl($this->urlGenerator); - if ($logoutUrl !== '') { - // Logout - $this->add([ - 'type' => 'settings', - 'id' => 'logout', - 'order' => 99999, - 'href' => $logoutUrl, - 'name' => $l->t('Log out'), - 'icon' => $this->urlGenerator->imagePath('core', 'actions/logout.svg'), - ]); - } + // Logout + $this->add([ + 'type' => 'settings', + 'id' => 'logout', + 'order' => 99999, + 'href' => $logoutUrl, + 'name' => $l->t('Log out'), + 'icon' => $this->urlGenerator->imagePath('core', 'actions/logout.svg'), + ]); if ($this->isSubadmin()) { // User management diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php index 7d56b94704a8d..f72b9a8958bc8 100644 --- a/lib/private/legacy/OC_User.php +++ b/lib/private/legacy/OC_User.php @@ -272,7 +272,7 @@ public static function isIncognitoMode() { * Returns the current logout URL valid for the currently logged-in user * * @param \OCP\IURLGenerator $urlGenerator - * @return string + * @return non-empty-string */ public static function getLogoutUrl(\OCP\IURLGenerator $urlGenerator) { $backend = self::findFirstActiveUsedBackend(); @@ -284,7 +284,10 @@ public static function getLogoutUrl(\OCP\IURLGenerator $urlGenerator) { if ($user instanceof IUser) { $backend = $user->getBackend(); if ($backend instanceof \OCP\User\Backend\ICustomLogout) { - return $backend->getLogoutUrl(); + $logoutUrl = $backend->getLogoutUrl(); + if ($logoutUrl !== '') { + return $logoutUrl; + } } } diff --git a/lib/public/Authentication/IApacheBackend.php b/lib/public/Authentication/IApacheBackend.php index 1e6b7bafa47b9..375da38ba0671 100644 --- a/lib/public/Authentication/IApacheBackend.php +++ b/lib/public/Authentication/IApacheBackend.php @@ -27,7 +27,7 @@ public function isSessionActive(); /** * Gets the current logout URL * - * @return string + * @return non-empty-string * @since 12.0.3 */ public function getLogoutUrl();