mirror of
https://github.com/elyby/accounts.git
synced 2024-11-30 02:32:26 +05:30
Handle legacy refresh tokens
This commit is contained in:
parent
a9a56c9e1d
commit
060a4e960a
@ -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) {
|
||||||
|
@ -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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user