diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php index ec4cc10c269d9..0e1196a9da4a3 100644 --- a/lib/private/Authentication/Token/DefaultTokenProvider.php +++ b/lib/private/Authentication/Token/DefaultTokenProvider.php @@ -192,6 +192,7 @@ public function renewSessionToken($oldSessionId, $sessionId) { $newToken->setName($token->getName()); $newToken->setToken($this->hashToken($sessionId)); $newToken->setType(IToken::TEMPORARY_TOKEN); + $newToken->setRemember($token->getRemember()); $newToken->setLastActivity($this->time->getTime()); $this->mapper->insert($newToken); } diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php index 8d92ee405a1fd..e354fcc7172b3 100644 --- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php +++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php @@ -292,6 +292,10 @@ public function testRenewSessionTokenWithoutPassword() { ->expects($this->at(3)) ->method('getName') ->willReturn('MyTokenName'); + $token + ->expects($this->at(3)) + ->method('getRememberMe') + ->willReturn(IToken::DO_NOT_REMEMBER); $this->config ->expects($this->exactly(2)) ->method('getSystemValue') @@ -308,6 +312,7 @@ public function testRenewSessionTokenWithoutPassword() { $newToken->setName('MyTokenName'); $newToken->setToken(hash('sha512', 'newId' . 'MyInstanceSecret')); $newToken->setType(IToken::TEMPORARY_TOKEN); + $newToken->setRemember(IToken::DO_NOT_REMEMBER); $newToken->setLastActivity(1313131); $this->mapper ->expects($this->at(1)) @@ -342,6 +347,10 @@ public function testRenewSessionTokenWithPassword() { ->expects($this->at(4)) ->method('getName') ->willReturn('MyTokenName'); + $token + ->expects($this->at(3)) + ->method('getRememberMe') + ->willReturn(IToken::REMEMBER); $this->crypto ->expects($this->any(0)) ->method('decrypt') @@ -368,12 +377,13 @@ public function testRenewSessionTokenWithPassword() { $newToken->setName('MyTokenName'); $newToken->setToken(hash('sha512', 'newId' . 'MyInstanceSecret')); $newToken->setType(IToken::TEMPORARY_TOKEN); + $newToken->setRemember(IToken::REMEMBER); $newToken->setLastActivity(1313131); $newToken->setPassword('EncryptedPassword'); $this->mapper ->expects($this->at(1)) ->method('insert') - ->with($newToken); + ->with($this->equalTo($newToken)); $this->tokenProvider->renewSessionToken('oldId', 'newId'); }