Add authentication methods to access protected resources #15

Merged
Wesser merged 13 commits from feat/auth into release/v1.0.0 2024-06-28 23:14:18 +03:00
Showing only changes of commit f89136669d - Show all commits

View File

@ -81,14 +81,18 @@ public class AuthService(ICacheService cache, IAccessToken accessTokenService, I
var (token, expireIn) = GenerateAccessToken(authToken.UserId);
await RevokeAccessToken(authToken.AccessToken);
var newRefreshToken = GenerateRefreshToken();
authToken.AccessToken = token;
authToken.RefreshToken = newRefreshToken;
await SetAuthTokenDataToCache(request.Fingerprint, authToken, cancellation);
return new AuthTokenResponse
{
AccessToken = token,
AccessExpiresIn = expireIn,
RefreshToken = GenerateRefreshToken(),
RefreshToken = newRefreshToken,
RefreshExpiresIn = DateTime.UtcNow.Add(Lifetime)
};
}