diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 483250b1237cf..7d7f2aea776f9 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -2381,7 +2381,7 @@ - + parent::getExpires() parent::getLastCheck() parent::getLoginName() @@ -2398,6 +2398,7 @@ parent::setScope(json_encode($scope)) parent::setToken($token) parent::setType(IToken::WIPE_TOKEN) + parent::getType() diff --git a/lib/private/Authentication/Token/IToken.php b/lib/private/Authentication/Token/IToken.php index 5ca4eaea84372..d7842293f8a46 100644 --- a/lib/private/Authentication/Token/IToken.php +++ b/lib/private/Authentication/Token/IToken.php @@ -111,6 +111,14 @@ public function getName(): string; */ public function getRemember(): int; + /** + * Get the token type + * + * @return int + * @psalm-return IToken::DO_NOT_REMEMBER|IToken::REMEMBER + */ + public function getType(): int; + /** * Set the token * diff --git a/lib/private/Authentication/Token/PublicKeyToken.php b/lib/private/Authentication/Token/PublicKeyToken.php index d060fe141032b..f7ec6fd592e85 100644 --- a/lib/private/Authentication/Token/PublicKeyToken.php +++ b/lib/private/Authentication/Token/PublicKeyToken.php @@ -35,7 +35,6 @@ * @method void setLoginName(string $loginname) * @method string getToken() * @method void setType(int $type) - * @method int getType() * @method void setRemember(int $remember) * @method void setLastActivity(int $lastactivity) * @method int getLastActivity() @@ -201,6 +200,10 @@ public function setName(string $name): void { parent::setName($name); } + public function getType(): int { + return parent::getType(); + } + public function getRemember(): int { return parent::getRemember(); } diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 626ddca2dadd8..1f4c48c6ce6fc 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -835,8 +835,7 @@ public function tryTokenLogin(IRequest $request) { return true; } - // Remember me tokens are not app_passwords - if ($dbToken->getRemember() === IToken::DO_NOT_REMEMBER) { + if ($dbToken->getType() === IToken::PERMANENT_TOKEN) { // Set the session variable so we know this is an app password $this->session->set('app_password', $token); }