Example #1
0
        public void CheckData()
        {
            WebClientToken clientToken;

            clientToken = new WebClientToken(TEST_USER_NAME, ApplicationIdentifier, WebServiceData.WebServiceManager.Key);
            clientToken.CheckData();
        }
Example #2
0
        public void CheckData()
        {
            WebClientToken clientToken;

            clientToken = new WebClientToken(Settings.Default.TestUserName, Settings.Default.TestClientApplicationName, WebServiceData.WebServiceManager.Key);
            clientToken.CheckData();
            clientToken = new WebClientToken(Settings.Default.TestUserName, Settings.Default.TestClientApplicationName, WebServiceData.WebServiceManager.Key);
            clientToken.CheckData();
        }
Example #3
0
        public void TokenNullError()
        {
            String         token;
            CipherString   cipherString;
            WebClientToken clientToken;

            cipherString = new CipherString();
            token        = cipherString.EncryptText(null);
            clientToken  = new WebClientToken(token, WebServiceData.WebServiceManager.Key);
            clientToken.CheckData();
        }
Example #4
0
        public void TokenFormatError()
        {
            String         token;
            CipherString   cipherString;
            WebClientToken clientToken;

            token        = "Hej hopp i lingon skogen!";
            cipherString = new CipherString();
            token        = cipherString.EncryptText(token);
            clientToken  = new WebClientToken(token, WebServiceData.WebServiceManager.Key);
            clientToken.CheckData();
        }
Example #5
0
        /// <summary>
        /// Create a WebServiceContext instance.
        /// </summary>
        /// <param name='clientToken'>Token with information about current user and connection</param>
        /// <param name='checkUser'>Information about if user authority should be checked.
        ///                         It should only be set to false during login.</param>
        /// <param name='traceMethod'>Name of calling method. Used during tracing.</param>
        /// <param name='traceArgument1'>Argument 1 to the calling method. Used during tracing.</param>
        /// <param name='traceArgument2'>Argument 2 to the calling method. Used during tracing.</param>
        /// <param name='traceArgument3'>Argument 3 to the calling method. Used during tracing.</param>
        public WebServiceContext(WebClientToken clientToken,
                                 Boolean checkUser,
                                 String traceMethod,
                                 Object traceArgument1,
                                 Object traceArgument2,
                                 Object traceArgument3)
        {
            // Init context.
            _databases      = new DataServer[Enum.GetNames(typeof(DataServer.DatabaseId)).Length];
            _clientToken    = clientToken;
            _locale         = null;
            _requestId      = GetNextRequestId();
            _traceArgument1 = traceArgument1;
            _traceArgument2 = traceArgument2;
            _traceArgument3 = traceArgument3;
            _traceMethod    = traceMethod;
            if (_isTracing)
            {
                _traceStart = DateTime.Now;
            }
            else
            {
                _traceStart = DateTime.MinValue;
            }
            _transactionTimeout = DEFAULT_TRANSACTION_TIMEOUT;

            // Check arguments.
            try
            {
                clientToken.CheckNotNull("clientToken");
                if (checkUser)
                {
                    clientToken.CheckData();
                    CheckUser();
                }
                CheckClientIPAddress();
                CheckHttpsProtocol();
            }
            catch (Exception exception)
            {
                LogManager.LogSecurityError(this, exception);
                throw exception;
            }
        }
Example #6
0
        public void CheckDataSessionIdFormatError()
        {
            CipherString   cipherString;
            String         token;
            WebClientToken clientToken;

            token = WebClientToken.GetRandomText() + WebService.Settings.Default.ClientTokenDelimiter +
                    DateTime.Now.WebToString() + WebService.Settings.Default.ClientTokenDelimiter +
                    Settings.Default.TestUserName + WebService.Settings.Default.ClientTokenDelimiter +
                    Settings.Default.TestClientApplicationName + WebService.Settings.Default.ClientTokenDelimiter +
                    "Hej" + WebService.Settings.Default.ClientTokenDelimiter +
                    WebServiceContext.GetClientIpAddress() + WebService.Settings.Default.ClientTokenDelimiter +
                    WebServiceData.WebServiceManager.Name + WebService.Settings.Default.ClientTokenDelimiter +
                    WebClientToken.GetRandomText();
            cipherString = new CipherString();
            token        = cipherString.EncryptText(token);
            clientToken  = new WebClientToken(token, WebServiceData.WebServiceManager.Key);
            clientToken.CheckData();
        }
Example #7
0
        public void CheckDataClientIpAddressToLongError()
        {
            CipherString   cipherString;
            String         token;
            WebClientToken clientToken;

            token = WebClientToken.GetRandomText() + WebService.Settings.Default.ClientTokenDelimiter +
                    DateTime.Now.WebToString() + WebService.Settings.Default.ClientTokenDelimiter +
                    Settings.Default.TestUserName + WebService.Settings.Default.ClientTokenDelimiter +
                    Settings.Default.TestPassword + WebService.Settings.Default.ClientTokenDelimiter +
                    42 + WebService.Settings.Default.ClientTokenDelimiter +
                    GetString(WebService.Settings.Default.IPv6MaxStringLength + 1) + WebService.Settings.Default.ClientTokenDelimiter +
                    WebServiceData.WebServiceManager.Name + WebService.Settings.Default.ClientTokenDelimiter +
                    WebClientToken.GetRandomText();
            cipherString = new CipherString();
            token        = cipherString.EncryptText(token);
            clientToken  = new WebClientToken(token, WebServiceData.WebServiceManager.Key);
            clientToken.CheckData();
        }