summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-09-25 17:39:02 +0200
committerGitHub <noreply@github.com>2017-09-25 17:39:02 +0200
commit292a7046482e1fb5dc7eb7712d205ec37fe6f3e1 (patch)
treefcf4e01c26827c830d17154b3020350351535b53
parent9080976975c97ef7d377bb068bdf3e7e9e7746bf (diff)
parent38bb6e1477f7ddcc4eab6ab2f0ab3bb435ce1071 (diff)
downloadnextcloud-server-292a7046482e1fb5dc7eb7712d205ec37fe6f3e1.tar.gz
nextcloud-server-292a7046482e1fb5dc7eb7712d205ec37fe6f3e1.zip
Merge pull request #6544 from nextcloud/fix/duplicate-session-token
Fix duplicate session token after remembered login
-rw-r--r--lib/private/Authentication/Token/DefaultTokenProvider.php1
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenProviderTest.php8
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php
index a1a7e83ea21..80bcc4aeac8 100644
--- a/lib/private/Authentication/Token/DefaultTokenProvider.php
+++ b/lib/private/Authentication/Token/DefaultTokenProvider.php
@@ -195,6 +195,7 @@ class DefaultTokenProvider implements IProvider {
$newToken->setRemember($token->getRemember());
$newToken->setLastActivity($this->time->getTime());
$this->mapper->insert($newToken);
+ $this->mapper->delete($token);
}
/**
diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
index 2c8c2d7e196..96fdbaa176f 100644
--- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
@@ -318,6 +318,10 @@ class DefaultTokenProviderTest extends TestCase {
->expects($this->at(1))
->method('insert')
->with($newToken);
+ $this->mapper
+ ->expects($this->at(2))
+ ->method('delete')
+ ->with($token);
$this->tokenProvider->renewSessionToken('oldId', 'newId');
}
@@ -384,6 +388,10 @@ class DefaultTokenProviderTest extends TestCase {
->expects($this->at(1))
->method('insert')
->with($this->equalTo($newToken));
+ $this->mapper
+ ->expects($this->at(2))
+ ->method('delete')
+ ->with($token);
$this->tokenProvider->renewSessionToken('oldId', 'newId');
}