mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
Updeted Session Model and Session Opener Service
renamed RefreshToken in model to RefreshTokenHash - now we have a hash of token, not a token
This commit is contained in:
@@ -6,7 +6,7 @@ public class UserSession
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid UserId { get; set; }
|
||||
public string RefreshToken { get; set; } = string.Empty;
|
||||
public string RefreshTokenHash { get; set; } = string.Empty;
|
||||
public string DeviceInfo { get; set; } = string.Empty; // "Chrome on Windows"
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime ExpiresAt { get; set; }
|
||||
@@ -21,7 +21,7 @@ public class UserSession
|
||||
|
||||
return Id == userSession.Id &&
|
||||
UserId == userSession.UserId &&
|
||||
RefreshToken == userSession.RefreshToken &&
|
||||
RefreshTokenHash == userSession.RefreshTokenHash &&
|
||||
DeviceInfo == userSession.DeviceInfo &&
|
||||
CreatedAt == userSession.CreatedAt &&
|
||||
ExpiresAt == userSession.ExpiresAt &&
|
||||
|
||||
@@ -5,6 +5,6 @@ namespace Govor.Core.Repositories.UserSessionsRepository;
|
||||
public interface IUserSessionsExist
|
||||
{
|
||||
public bool Exist(Guid sessionId);
|
||||
public bool Exist(string refresh);
|
||||
public bool Exist(string hashedToken);
|
||||
public bool Exist(UserSession userSession);
|
||||
}
|
||||
@@ -10,5 +10,5 @@ public interface IUserSessionsReader
|
||||
public Task<List<UserSession>> GetByCreatedAtAsync(DateTime createdAt);
|
||||
public Task<List<UserSession>> GetByExpiresAtAsync(DateTime createdAt);
|
||||
public Task<List<UserSession>> GetByRevokedAsync(bool isRevoked);
|
||||
public Task<UserSession> GetByRefreshTokenAsync(string refreshToken);
|
||||
public Task<UserSession> GetByHashedRefreshTokenAsync(string hash);
|
||||
}
|
||||
Reference in New Issue
Block a user