feat: add logout functionality
This commit is contained in:
@@ -21,4 +21,14 @@ export class AuthRedisProvider {
|
||||
async revokeRefreshToken(jti: string) {
|
||||
await this.redisService.del(`rt:${jti}`);
|
||||
}
|
||||
|
||||
async blacklistAccessToken(jti: string, ttl: number) {
|
||||
if (ttl <= 0) return;
|
||||
|
||||
await this.redisService.set(`at:bl:${jti}`, '1', ttl);
|
||||
}
|
||||
|
||||
async isAccessTokenBlacklisted(jti: string) {
|
||||
return !!(await this.redisService.get(`at:bl:${jti}`));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user