feat: add logout

This commit is contained in:
Polianin Nikita 2024-05-29 05:56:27 +03:00
parent d84011cd71
commit 61218c38a0

View File

@ -86,4 +86,14 @@ public class AuthService(ICacheService cache, IAccessToken accessTokenService, I
RefreshToken = GenerateRefreshToken() RefreshToken = GenerateRefreshToken()
}; };
} }
public async Task LogoutAsync(string fingerprint, CancellationToken cancellation = default)
{
var authTokenStruct = await cache.GetAsync<AuthToken>(GetAuthCacheKey(fingerprint), cancellation);
if (authTokenStruct == null) return;
await RevokeAccessToken(authTokenStruct.AccessToken);
await cache.RemoveAsync(fingerprint, cancellation);
}
} }