File expiration

This commit is contained in:
2025-07-27 01:43:54 +08:00
parent 71accd725e
commit 4e68ab4ef0
12 changed files with 420 additions and 40 deletions

View File

@@ -1,3 +1,4 @@
using DysonNetwork.Pass.Wallet;
using DysonNetwork.Shared.Cache;
using DysonNetwork.Shared.Proto;
using Grpc.Core;
@@ -8,6 +9,7 @@ namespace DysonNetwork.Pass.Auth;
public class AuthServiceGrpc(
AuthService authService,
SubscriptionService subscriptions,
ICacheService cache,
AppDatabase db
)
@@ -36,6 +38,9 @@ public class AuthServiceGrpc(
var now = SystemClock.Instance.GetCurrentInstant();
if (session.ExpiredAt.HasValue && session.ExpiredAt < now)
return new AuthenticateResponse { Valid = false, Message = "Session has been expired." };
var perk = await subscriptions.GetPerkSubscriptionAsync(session.AccountId);
session.Account.PerkSubscription = perk?.ToReference();
await cache.SetWithGroupsAsync(
$"auth:{sessionId}",