Add hashing and other security features #12
@ -31,10 +31,8 @@ public class AuthService(ICacheService cache, IAccessToken accessTokenService, I
|
|||||||
private Task RevokeAccessToken(string token) =>
|
private Task RevokeAccessToken(string token) =>
|
||||||
revokedToken.AddTokenToRevokedAsync(token, accessTokenService.GetExpireDateTime(token));
|
revokedToken.AddTokenToRevokedAsync(token, accessTokenService.GetExpireDateTime(token));
|
||||||
|
|
||||||
public async Task<AuthTokenResponse> GenerateAuthTokensAsync(TokenRequest request, string preAuthToken, CancellationToken cancellation = default)
|
public async Task<AuthTokenResponse> GenerateAuthTokensAsync(TokenRequest request, string userId, CancellationToken cancellation = default)
|
||||||
{
|
{
|
||||||
string userId = await new PreAuthService(cache).MatchToken(request, preAuthToken, cancellation);
|
|
||||||
|
|
||||||
var refreshToken = GenerateRefreshToken();
|
var refreshToken = GenerateRefreshToken();
|
||||||
var accessToken = GenerateAccessToken(userId);
|
var accessToken = GenerateAccessToken(userId);
|
||||||
|
|
||||||
@ -58,6 +56,12 @@ public class AuthService(ICacheService cache, IAccessToken accessTokenService, I
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<AuthTokenResponse> GenerateAuthTokensWithPreAuthAsync(TokenRequest request, string preAuthToken,
|
||||||
|
CancellationToken cancellation = default) =>
|
||||||
|
await GenerateAuthTokensAsync(request,
|
||||||
|
await new PreAuthService(cache).MatchToken(request, preAuthToken, cancellation),
|
||||||
|
cancellation);
|
||||||
|
|
||||||
public async Task<AuthTokenResponse> RefreshTokenAsync(TokenRequest request, string refreshToken, CancellationToken cancellation = default)
|
public async Task<AuthTokenResponse> RefreshTokenAsync(TokenRequest request, string refreshToken, CancellationToken cancellation = default)
|
||||||
{
|
{
|
||||||
var authToken = await cache.GetAsync<AuthToken>(GetAuthCacheKey(request.Fingerprint), cancellation)
|
var authToken = await cache.GetAsync<AuthToken>(GetAuthCacheKey(request.Fingerprint), cancellation)
|
||||||
|
Loading…
Reference in New Issue
Block a user