Skip to content

Commit

Permalink
Merge pull request #11302 from nextcloud/backport/11297/this-database…
Browse files Browse the repository at this point in the history
…-dude

[stable14] Fix expiration code of tokens
  • Loading branch information
blizzz authored Sep 20, 2018
2 parents 0c85cb1 + 6718bfb commit ea73f30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/private/Authentication/Token/DefaultTokenProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function getTokenById(int $tokenId): IToken {
throw new InvalidTokenException();
}

if ($token->getExpires() !== null && $token->getExpires() < $this->time->getTime()) {
if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) {
throw new ExpiredTokenException($token);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/private/Authentication/Token/PublicKeyTokenProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function getToken(string $tokenId): IToken {
throw new InvalidTokenException();
}

if ($token->getExpires() !== null && $token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) {
if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) {
throw new ExpiredTokenException($token);
}

Expand All @@ -94,7 +94,7 @@ public function getTokenById(int $tokenId): IToken {
throw new InvalidTokenException();
}

if ($token->getExpires() !== null && $token->getExpires() < $this->time->getTime()) {
if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) {
throw new ExpiredTokenException($token);
}

Expand Down

0 comments on commit ea73f30

Please sign in to comment.