Handle legacy refresh tokens

This commit is contained in:
ErickSkrauch 2019-12-04 13:40:12 +03:00
parent a9a56c9e1d
commit 060a4e960a
2 changed files with 6 additions and 2 deletions

View File

@ -46,6 +46,11 @@ class RefreshTokenGrant extends BaseRefreshTokenGrant {
return null; return null;
} }
/**
* @param string $refreshToken
* @return array
* @throws OAuthServerException
*/
private function validateLegacyRefreshToken(string $refreshToken): array { private function validateLegacyRefreshToken(string $refreshToken): array {
$result = Yii::$app->redis->get("oauth:refresh:tokens:{$refreshToken}"); $result = Yii::$app->redis->get("oauth:refresh:tokens:{$refreshToken}");
if ($result === null) { if ($result === null) {

View File

@ -30,8 +30,7 @@ class RefreshTokenRepository implements RefreshTokenRepositoryInterface {
} }
public function isRefreshTokenRevoked($tokenId): bool { public function isRefreshTokenRevoked($tokenId): bool {
// TODO: validate old refresh tokens return OauthRefreshToken::find()->andWhere(['id' => $tokenId])->exists() === false;
return !OauthRefreshToken::find()->andWhere(['id' => $tokenId])->exists();
} }
} }