using System.Net; namespace OliverBooth.Data.Blog; /// /// Represents a login session. /// public interface ISession { /// /// Gets the date and time at which this session was created. /// /// The creation timestamp. DateTimeOffset Created { get; } /// /// Gets the date and time at which this session expires. /// /// The expiration timestamp. DateTimeOffset Expires { get; } /// /// Gets the ID of the session. /// /// The ID of the session. Guid Id { get; } /// /// Gets the IP address of the session. /// /// The IP address. IPAddress IpAddress { get; } /// /// Gets the date and time at which this session was last accessed. /// /// The last access timestamp. DateTimeOffset LastAccessed { get; } /// /// Gets a value indicating whether this session is valid. /// /// if the session is valid; otherwise, . bool RequiresTotp { get; } /// /// Gets the date and time at which this session was updated. /// /// The update timestamp. DateTimeOffset Updated { get; } /// /// Gets the user ID associated with the session. /// /// The user ID. Guid UserId { get; } } internal sealed class Session : ISession { /// public DateTimeOffset Created { get; set; } /// public DateTimeOffset Expires { get; set; } /// public Guid Id { get; private set; } = Guid.NewGuid(); /// public IPAddress IpAddress { get; set; } = IPAddress.None; /// public DateTimeOffset LastAccessed { get; set; } /// public bool RequiresTotp { get; set; } /// public DateTimeOffset Updated { get; set; } /// public Guid UserId { get; set; } }