From 0837092d5ffabc27cc30e3bf5c78c0373fa795df Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sun, 25 Feb 2024 14:12:04 +0000 Subject: [PATCH] fix: fix expiration date check --- OliverBooth/Services/SessionService.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OliverBooth/Services/SessionService.cs b/OliverBooth/Services/SessionService.cs index e3bf457..bb0c8e7 100644 --- a/OliverBooth/Services/SessionService.cs +++ b/OliverBooth/Services/SessionService.cs @@ -151,6 +151,12 @@ internal sealed class SessionService : ISessionService return false; } + if (session.Expires <= DateTimeOffset.UtcNow) + { + _logger.LogInformation("Session {Id} has expired (client {Ip})", session.Id, remoteIpAddress); + return false; + } + Span remoteAddressBytes = stackalloc byte[16]; Span sessionAddressBytes = stackalloc byte[16]; if (!remoteIpAddress.TryWriteBytes(remoteAddressBytes, out _) ||