summaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2016-11-27 14:19:57 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2016-11-27 14:19:57 +0100
commit2183a1f3e6dddae2f49a0bd9ad30e1670f2d9d15 (patch)
treed1faca92deb7342d2adb2e206da40eb6113f83bc /tests/lib/Authentication
parent7e6f829d546a95acc3421c5fd9dd7574fa291994 (diff)
downloadnextcloud-server-2183a1f3e6dddae2f49a0bd9ad30e1670f2d9d15.tar.gz
nextcloud-server-2183a1f3e6dddae2f49a0bd9ad30e1670f2d9d15.zip
copy remember-me value when renewing a session token
On renew, a session token is duplicated. For some reason we did not copy over the remember-me attribute value. Hence, the new token was deleted too early in the background job and remember-me did not work properly. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Authentication')
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenProviderTest.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
index 8d92ee405a1..e354fcc7172 100644
--- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
@@ -292,6 +292,10 @@ class DefaultTokenProviderTest extends TestCase {
->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 @@ class DefaultTokenProviderTest extends TestCase {
$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 @@ class DefaultTokenProviderTest extends TestCase {
->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 @@ class DefaultTokenProviderTest extends TestCase {
$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');
}