public async Task SetClaimsAsync(OdissUser user, IList <Claim> claims) { var session = await sessionStore.GetByUserIdAsync(user.Id); if (session == null) { throw new NullReferenceException("No session for user found"); } session.Data = serialization.Serialize(claims); await sessionStore.UpdateAsync(session); }
/// <summary> /// Extends the session by the configured maximum session timeout /// </summary> public async Task ExtendAsync(TSessionKey sessionId) { var session = await store.GetAsync(sessionId); session.ExpiryDate = DateTime.Now.Add(MaximumSessionTimeout); session.LastActionAt = DateTime.Now; await store.UpdateAsync(session); logger.LogSystemActivity("User Session Extended", session.ToLogMessage()); var deletedSessions = await store.ClearSessionsAsync(); if (deletedSessions.Any()) { logger.LogSystemActivity("Expired User Sessions Deleted", deletedSessions.Select(x => x.ToLogMessage())); } }