public IActionResult Logout() { var sessionId = HttpContext.GetSessionId(); _sessionTracker.EndSession(sessionId); _tokenController.RevokeToken(HttpContext); return(Ok()); }
public void CanEndSession() { // Arrange var sessionTracker = new SessionTracker(new NullLogger <SessionTracker>(), DefaultTimeoutCheckInterval, DefaultTimeoutCheckInterval); var game = Helpers.GetOrCreateGame("CanEndSession"); var user = Helpers.GetOrCreateUser($"CanEndSession"); var session = sessionTracker.StartSession(game.Id, user.Id); // Act sessionTracker.EndSession(session.Id); // Assert Assert.False(sessionTracker.IsActive(session.Id)); }
public void RemovesOnSessionEnded() { // Arrange var game = Helpers.GetOrCreateGame("RemovesOnSessionEnded"); var user = Helpers.GetOrCreateUser("RemovesOnSessionEnded"); Helpers.CreateAndCompleteGenericAchievement("RemovesOnSessionEnded", user.Id, game.Id); var session = SessionTracker.StartSession(game.Id, user.Id); var progress = EvaluationTracker.GetPendingNotifications(game.Id, user.Id); Assert.True(progress.ContainsKey(user.Id)); // should have evalauted for this user // Act SessionTracker.EndSession(session.Id); // Assert progress = EvaluationTracker.GetPendingNotifications(game.Id, user.Id); Assert.False(progress.ContainsKey(user.Id)); // Shouldn't have any progress for this user }
/// <summary> /// Connection ending point /// </summary> /// <param name="e"></param> protected override void OnClose(CloseEventArgs e) { tracker.EndSession(GetAuth0Cookie()); base.OnClose(e); }