Skip to content

Commit df4746f

Browse files
ChristophWurstbackportbot[bot]
authored andcommitted
fix(session): Only mark sessions of permanent tokens as app passwords
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at> [skip ci]
1 parent c3d0afd commit df4746f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/private/User/Session.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,9 +833,8 @@ public function tryTokenLogin(IRequest $request) {
833833
return true;
834834
}
835835

836-
// Remember me tokens are not app_passwords
837-
if ($dbToken->getRemember() === IToken::DO_NOT_REMEMBER) {
838-
// Set the session variable so we know this is an app password
836+
// Set the session variable so we know this is an app password
837+
if ($dbToken instanceof PublicKeyToken && $dbToken->getType() === IToken::PERMANENT_TOKEN) {
839838
$this->session->set('app_password', $token);
840839
}
841840

tests/lib/User/SessionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use OCP\Security\Bruteforce\IThrottler;
3535
use OCP\Security\ISecureRandom;
3636
use OCP\User\Events\PostLoginEvent;
37+
use PHPUnit\Framework\ExpectationFailedException;
3738
use PHPUnit\Framework\MockObject\MockObject;
3839
use Psr\Log\LoggerInterface;
3940
use function array_diff;

0 commit comments

Comments
 (0)