private void HandleAuthTokenKey(IDBService dbProxy, IEncryption encryption)
        {
            if (AuthTokenHelper.IsAuthTokenExits(_httpProxy))
            {
                var userId = AuthTokenHelper.GetUserId(_httpProxy, dbProxy, encryption);

                var userTempData = _httpProxy.GetTempValue <UserModel>(CommonConst.CommonValue.SESSION_USER_KEY);
                if (userTempData == null)
                {
                    ISessionProvider session = new SessionProvider(_httpProxy, dbProxy, _logger);
                    var userData             = session.GetValue <UserModel>(CommonConst.CommonValue.SESSION_USER_KEY);
                    if (userData != null && userData.user_id != userId)
                    {
                        throw new Exception("Session user conflict with authtoken");
                    }
                    if (userData == null)
                    {
                        userData = dbProxy.FirstOrDefault <UserModel>(CommonConst.Collection.USERS, CommonConst.CommonField.USER_ID, userId);
                        if (userData == null)
                        {
                            throw new Exception("User not found for authtoken");
                        }
                    }
                    _httpProxy.SetTempValue <UserModel>(CommonConst.CommonValue.SESSION_USER_KEY, userData);
                }
            }
        }
 private void HandleSession(HttpContext context)
 {
     if (AuthTokenHelper.IsAuthTokenExits(_httpProxy))
     {
         // if there is auth token no cookies set in the response.
         return;
     }
     if (context.Request.Cookies[CommonConst.CommonValue.SESSION_COOKIE] == null)
     {
         CreateUpdateSessionCookie(context);
     }
     else
     {
         CreateUpdateSessionCookie(context, context.Request.Cookies[CommonConst.CommonValue.SESSION_COOKIE]);
     }
 }