예제 #1
0
        public void ProcessUpdateRequest(SNWLUpdateSessionRequest updateModel)
        {
            var session = _generatedSessions.Where(s => s.ID == updateModel.sessID).SingleOrDefault();

            if (session == null)
            {
                _logger.LogCritical($"Session with SessionID \"{updateModel.sessID}\" not found in local collection. Could not update.");
            }

            session.Status           = (SessionStatus)UpdateSessionReplyCode;
            session.UserName         = updateModel.userName;
            session.SessionRemaining = updateModel.sessionLifetime;
        }
예제 #2
0
        public IActionResult UpdateSession(SNWLUpdateSessionRequest model)
        {
            SNWLUpdateSessionReplyXMLResponse responseModel;

            if (!ModelState.IsValid)
            {
                return(new ObjectResult(ResponseHelper.UpdateSession.InvalidOrMissingCGIParamResponse()));
            }

            switch (_stateProvider.UpdateSessionReplyCode)
            {
            case ResponseHelper.UpdateSession.SESSION_UPDATE_SUCCEEDED:
                responseModel = ResponseHelper.UpdateSession.UpdateSessionSucceededResponse();
                break;

            case ResponseHelper.UpdateSession.SESSION_UPDATE_FAILED:
                responseModel = ResponseHelper.UpdateSession.UpdateSessionFailedResponse();
                break;

            case ResponseHelper.UpdateSession.INVALID_OR_MISSING_PARAM:
                responseModel = ResponseHelper.UpdateSession.InvalidOrMissingCGIParamResponse();
                break;

            case ResponseHelper.UpdateSession.INVALID_HMAC:
                responseModel = ResponseHelper.UpdateSession.InvalidHMACResponse();
                break;

            default:
            case ResponseHelper.UpdateSession.INTERNAL_ERROR:
                responseModel = ResponseHelper.UpdateSession.InternalErrorResponse();
                break;
            }

            // local bookkeeping
            _stateProvider.ProcessUpdateRequest(model);

            return(new ObjectResult(responseModel));
        }