Esempio n. 1
0
        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));
        }
Esempio n. 3
0
        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
        }
Esempio n. 4
0
 /// <summary>
 /// Connection ending point
 /// </summary>
 /// <param name="e"></param>
 protected override void OnClose(CloseEventArgs e)
 {
     tracker.EndSession(GetAuth0Cookie());
     base.OnClose(e);
 }