Files
Govor/Govor.Core/Models/UserSession.cs
T
Artemy ff873ae179 Implement refresh token flow and refactor session handling
Added refresh token endpoint and controller, introduced IUserSessionRefresher and UserSessionRefresher for token renewal, and updated session handling to return both access and refresh tokens. Refactored AuthController, tests, and related interfaces to support new token flow. Fixed JwtAccessOption property typo, updated configuration, and extended UserSessionsRepository to support lookup by refresh token.
2025-07-19 17:51:06 +07:00

25 lines
925 B
C#

namespace Govor.Core.Models;
public class UserSession
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid UserId { get; set; }
public string RefreshToken { 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; }
public bool IsRevoked { get; set; } = false;
public override bool Equals(object? obj)
{
UserSession? userSession = obj as UserSession;
return Id == userSession.Id &&
UserId == userSession.UserId &&
RefreshToken == userSession.RefreshToken &&
DeviceInfo == userSession.DeviceInfo &&
CreatedAt == userSession.CreatedAt &&
ExpiresAt == userSession.ExpiresAt &&
IsRevoked == userSession.IsRevoked;
}
}