From a04feff9a780d77ca172ba7558a7d0cc4e01dc36 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Fri, 18 Aug 2017 12:16:43 +0200 Subject: Properly allow \OCP\Authentication\IApacheBackend to specify logout URL Any `\OCP\Authentication\IApacheBackend` previously had to implement `getLogoutAttribute` which returns a string. This string is directly injected into the logout `` tag, so returning something like `href="foo"` would result in ``. This is rather error prone and also in Nextcloud 12 broken as the logout entry has been moved with 054e161eb5f4a5c5c13ee322ae8e93ce66f01b13 inside the navigation manager where one cannot simply inject attributes. Thus this feature is broken in Nextcloud 12 which effectively leads to the bug described at nextcloud/user_saml#112, people cannot logout anymore when using SAML using SLO. Basically in case of SAML you have a SLO url which redirects you to the IdP and properly logs you out there as well. Instead of monkey patching the Navigation manager I decided to instead change `\OCP\Authentication\IApacheBackend` to use `\OCP\Authentication\IApacheBackend::getLogoutUrl` instead where it can return a string with the appropriate logout URL. Since this functionality is only prominently used in the SAML plugin. Any custom app would need a small change but I'm not aware of any and there's simply no way to fix this properly otherwise. Signed-off-by: Lukas Reschke --- lib/private/legacy/user.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lib/private/legacy') diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php index 210e428a2e0..97f302c826e 100644 --- a/lib/private/legacy/user.php +++ b/lib/private/legacy/user.php @@ -281,16 +281,14 @@ class OC_User { } /** - * Supplies an attribute to the logout hyperlink. The default behaviour - * is to return an href with '?logout=true' appended. However, it can - * supply any attribute(s) which are valid for . + * Returns the current logout URL valid for the currently logged-in user * - * @return string with one or more HTML attributes. + * @return string */ - public static function getLogoutAttribute() { + public static function getLogoutUrl() { $backend = self::findFirstActiveUsedBackend(); if ($backend) { - return $backend->getLogoutAttribute(); + return $backend->getLogoutUrl(); } $logoutUrl = \OC::$server->getURLGenerator()->linkToRouteAbsolute( @@ -300,7 +298,7 @@ class OC_User { ] ); - return 'href="'.$logoutUrl.'"'; + return $logoutUrl; } /** -- cgit v1.2.3