Browse Source

Use non-absolute logout URL to fix wrong URL in reverse proxy scenario

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
tags/v17.0.0beta1
Morris Jobke 5 years ago
parent
commit
f095bd1642
No account linked to committer's email address
2 changed files with 5 additions and 7 deletions
  1. 1
    1
      lib/private/legacy/user.php
  2. 4
    6
      tests/lib/NavigationManagerTest.php

+ 1
- 1
lib/private/legacy/user.php View File

@@ -269,7 +269,7 @@ class OC_User {
return $backend->getLogoutUrl();
}

$logoutUrl = $urlGenerator->linkToRouteAbsolute('core.login.logout');
$logoutUrl = $urlGenerator->linkToRoute('core.login.logout');
$logoutUrl .= '?requesttoken=' . urlencode(\OCP\Util::callRegister());

return $logoutUrl;

+ 4
- 6
tests/lib/NavigationManagerTest.php View File

@@ -217,14 +217,12 @@ class NavigationManagerTest extends TestCase {
$this->urlGenerator->expects($this->any())->method('imagePath')->willReturnCallback(function ($appName, $file) {
return "/apps/$appName/img/$file";
});
$this->urlGenerator->expects($this->any())->method('linkToRoute')->willReturnCallback(function () {
$this->urlGenerator->expects($this->any())->method('linkToRoute')->willReturnCallback(function ($route) {
if ($route === 'core.login.logout') {
return 'https://example.com/logout';
}
return '/apps/test/';
});
$this->urlGenerator
->expects($this->once())
->method('linkToRouteAbsolute')
->with('core.login.logout')
->willReturn('https://example.com/logout');
$user = $this->createMock(IUser::class);
$user->expects($this->any())->method('getUID')->willReturn('user001');
$this->userSession->expects($this->any())->method('getUser')->willReturn($user);

Loading…
Cancel
Save