diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php index a1a7e83ea21c6b8f102bb79b6da0e01e91e89306..80bcc4aeac8d786a8c9296f73cda7b8f788606cd 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 2c8c2d7e1968b87891db887012311f5300342653..96fdbaa176f5167c88f3cdeca045af41972b06b1 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'); }